<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP, DeriveFunctor #-}</span><span>
</span><span id="line-2"></span><span>
</span><span id="line-3"></span><span class="hs-comment">--</span><span>
</span><span id="line-4"></span><span class="hs-comment">-- (c) The GRASP/AQUA Project, Glasgow University, 1993-1998</span><span>
</span><span id="line-5"></span><span class="hs-comment">--</span><span>
</span><span id="line-6"></span><span>
</span><span id="line-7"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- Converting Core to STG Syntax</span><span>
</span><span id="line-9"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-10"></span><span>
</span><span id="line-11"></span><span class="hs-comment">-- And, as we have the info in hand, we may convert some lets to</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- let-no-escapes.</span><span>
</span><span id="line-13"></span><span>
</span><span id="line-14"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.CoreToStg</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#coreToStg"><span class="hs-identifier">coreToStg</span></a></span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-18"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-19"></span><span>
</span><span id="line-20"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.html"><span class="hs-identifier">GHC.Core</span></a></span><span>
</span><span id="line-21"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Utils.html"><span class="hs-identifier">GHC.Core.Utils</span></a></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.Utils.html#exprType"><span class="hs-identifier">exprType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Utils.html#findDefault"><span class="hs-identifier">findDefault</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Utils.html#isJoinBind"><span class="hs-identifier">isJoinBind</span></a></span><span>
</span><span id="line-22"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Utils.html#exprIsTickedString_maybe"><span class="hs-identifier">exprIsTickedString_maybe</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Opt.Arity.html"><span class="hs-identifier">GHC.Core.Opt.Arity</span></a></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.Opt.Arity.html#manifestArity"><span class="hs-identifier">manifestArity</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html"><span class="hs-identifier">GHC.Stg.Syntax</span></a></span><span>
</span><span id="line-25"></span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Type.html"><span class="hs-identifier">GHC.Core.Type</span></a></span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.RepType.html"><span class="hs-identifier">GHC.Types.RepType</span></a></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html"><span class="hs-identifier">GHC.Core.TyCon</span></a></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.Make.html"><span class="hs-identifier">GHC.Types.Id.Make</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Id.Make.html#coercionTokenId"><span class="hs-identifier">coercionTokenId</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.html"><span class="hs-identifier">GHC.Types.Id</span></a></span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.Info.html"><span class="hs-identifier">GHC.Types.Id.Info</span></a></span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html"><span class="hs-identifier">GHC.Core.DataCon</span></a></span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.html"><span class="hs-identifier">GHC.Types.CostCentre</span></a></span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html"><span class="hs-identifier">GHC.Types.Var.Env</span></a></span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html"><span class="hs-identifier">GHC.Unit.Module</span></a></span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.html"><span class="hs-identifier">GHC.Types.Name</span></a></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#isExternalName"><span class="hs-identifier">isExternalName</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#nameModule_maybe"><span class="hs-identifier">nameModule_maybe</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Arity"><span class="hs-identifier">Arity</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html"><span class="hs-identifier">GHC.Builtin.Types</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html#unboxedUnitDataCon"><span class="hs-identifier">unboxedUnitDataCon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html#unitDataConId"><span class="hs-identifier">unitDataConId</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Literal.html"><span class="hs-identifier">GHC.Types.Literal</span></a></span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Monad.html"><span class="hs-identifier">GHC.Utils.Monad</span></a></span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html"><span class="hs-identifier">GHC.Data.FastString</span></a></span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Ways.html"><span class="hs-identifier">GHC.Driver.Ways</span></a></span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.ForeignCall.html"><span class="hs-identifier">GHC.Types.ForeignCall</span></a></span><span>
</span><span id="line-47"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html"><span class="hs-identifier">GHC.Types.Demand</span></a></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#isUsedOnce"><span class="hs-identifier">isUsedOnce</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.PrimOps.html"><span class="hs-identifier">GHC.Builtin.PrimOps</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Builtin.PrimOps.html#PrimCall"><span class="hs-identifier">PrimCall</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html"><span class="hs-identifier">GHC.Types.SrcLoc</span></a></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#mkGeneralSrcSpan"><span class="hs-identifier">mkGeneralSrcSpan</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-50"></span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.NonEmpty.html#"><span class="hs-identifier">Data.List.NonEmpty</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.List.NonEmpty.html#nonEmpty"><span class="hs-identifier">nonEmpty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.List.NonEmpty.html#toList"><span class="hs-identifier">toList</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Maybe.html#"><span class="hs-identifier">Data.Maybe</span></a></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Maybe.html#fromMaybe"><span class="hs-identifier">fromMaybe</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-53"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#ap"><span class="hs-identifier">ap</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-54"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../containers/src/Data.Set.html#"><span class="hs-identifier">Data.Set</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Set</span></span><span>
</span><span id="line-55"></span><span>
</span><span id="line-56"></span><span class="hs-comment">-- Note [Live vs free]</span><span>
</span><span id="line-57"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-58"></span><span class="hs-comment">--</span><span>
</span><span id="line-59"></span><span class="hs-comment">-- The two are not the same. Liveness is an operational property rather</span><span>
</span><span id="line-60"></span><span class="hs-comment">-- than a semantic one. A variable is live at a particular execution</span><span>
</span><span id="line-61"></span><span class="hs-comment">-- point if it can be referred to directly again. In particular, a dead</span><span>
</span><span id="line-62"></span><span class="hs-comment">-- variable's stack slot (if it has one):</span><span>
</span><span id="line-63"></span><span class="hs-comment">--</span><span>
</span><span id="line-64"></span><span class="hs-comment">--           - should be stubbed to avoid space leaks, and</span><span>
</span><span id="line-65"></span><span class="hs-comment">--           - may be reused for something else.</span><span>
</span><span id="line-66"></span><span class="hs-comment">--</span><span>
</span><span id="line-67"></span><span class="hs-comment">-- There ought to be a better way to say this. Here are some examples:</span><span>
</span><span id="line-68"></span><span class="hs-comment">--</span><span>
</span><span id="line-69"></span><span class="hs-comment">--         let v = [q] \[x] -&gt; e</span><span>
</span><span id="line-70"></span><span class="hs-comment">--         in</span><span>
</span><span id="line-71"></span><span class="hs-comment">--         ...v...  (but no q's)</span><span>
</span><span id="line-72"></span><span class="hs-comment">--</span><span>
</span><span id="line-73"></span><span class="hs-comment">-- Just after the `in', v is live, but q is dead. If the whole of that</span><span>
</span><span id="line-74"></span><span class="hs-comment">-- let expression was enclosed in a case expression, thus:</span><span>
</span><span id="line-75"></span><span class="hs-comment">--</span><span>
</span><span id="line-76"></span><span class="hs-comment">--         case (let v = [q] \[x] -&gt; e in ...v...) of</span><span>
</span><span id="line-77"></span><span class="hs-comment">--                 alts[...q...]</span><span>
</span><span id="line-78"></span><span class="hs-comment">--</span><span>
</span><span id="line-79"></span><span class="hs-comment">-- (ie `alts' mention `q'), then `q' is live even after the `in'; because</span><span>
</span><span id="line-80"></span><span class="hs-comment">-- we'll return later to the `alts' and need it.</span><span>
</span><span id="line-81"></span><span class="hs-comment">--</span><span>
</span><span id="line-82"></span><span class="hs-comment">-- Let-no-escapes make this a bit more interesting:</span><span>
</span><span id="line-83"></span><span class="hs-comment">--</span><span>
</span><span id="line-84"></span><span class="hs-comment">--         let-no-escape v = [q] \ [x] -&gt; e</span><span>
</span><span id="line-85"></span><span class="hs-comment">--         in</span><span>
</span><span id="line-86"></span><span class="hs-comment">--         ...v...</span><span>
</span><span id="line-87"></span><span class="hs-comment">--</span><span>
</span><span id="line-88"></span><span class="hs-comment">-- Here, `q' is still live at the `in', because `v' is represented not by</span><span>
</span><span id="line-89"></span><span class="hs-comment">-- a closure but by the current stack state.  In other words, if `v' is</span><span>
</span><span id="line-90"></span><span class="hs-comment">-- live then so is `q'. Furthermore, if `e' mentions an enclosing</span><span>
</span><span id="line-91"></span><span class="hs-comment">-- let-no-escaped variable, then its free variables are also live if `v' is.</span><span>
</span><span id="line-92"></span><span>
</span><span id="line-93"></span><span class="hs-comment">-- Note [What are these SRTs all about?]</span><span>
</span><span id="line-94"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-95"></span><span class="hs-comment">--</span><span>
</span><span id="line-96"></span><span class="hs-comment">-- Consider the Core program,</span><span>
</span><span id="line-97"></span><span class="hs-comment">--</span><span>
</span><span id="line-98"></span><span class="hs-comment">--     fibs = go 1 1</span><span>
</span><span id="line-99"></span><span class="hs-comment">--       where go a b = let c = a + c</span><span>
</span><span id="line-100"></span><span class="hs-comment">--                      in c : go b c</span><span>
</span><span id="line-101"></span><span class="hs-comment">--     add x = map (\y -&gt; x*y) fibs</span><span>
</span><span id="line-102"></span><span class="hs-comment">--</span><span>
</span><span id="line-103"></span><span class="hs-comment">-- In this case we have a CAF, 'fibs', which is quite large after evaluation and</span><span>
</span><span id="line-104"></span><span class="hs-comment">-- has only one possible user, 'add'. Consequently, we want to ensure that when</span><span>
</span><span id="line-105"></span><span class="hs-comment">-- all references to 'add' die we can garbage collect any bit of 'fibs' that we</span><span>
</span><span id="line-106"></span><span class="hs-comment">-- have evaluated.</span><span>
</span><span id="line-107"></span><span class="hs-comment">--</span><span>
</span><span id="line-108"></span><span class="hs-comment">-- However, how do we know whether there are any references to 'fibs' still</span><span>
</span><span id="line-109"></span><span class="hs-comment">-- around? Afterall, the only reference to it is buried in the code generated</span><span>
</span><span id="line-110"></span><span class="hs-comment">-- for 'add'. The answer is that we record the CAFs referred to by a definition</span><span>
</span><span id="line-111"></span><span class="hs-comment">-- in its info table, namely a part of it known as the Static Reference Table</span><span>
</span><span id="line-112"></span><span class="hs-comment">-- (SRT).</span><span>
</span><span id="line-113"></span><span class="hs-comment">--</span><span>
</span><span id="line-114"></span><span class="hs-comment">-- Since SRTs are so common, we use a special compact encoding for them in: we</span><span>
</span><span id="line-115"></span><span class="hs-comment">-- produce one table containing a list of CAFs in a module and then include a</span><span>
</span><span id="line-116"></span><span class="hs-comment">-- bitmap in each info table describing which entries of this table the closure</span><span>
</span><span id="line-117"></span><span class="hs-comment">-- references.</span><span>
</span><span id="line-118"></span><span class="hs-comment">--</span><span>
</span><span id="line-119"></span><span class="hs-comment">-- See also: commentary/rts/storage/gc/CAFs on the GHC Wiki.</span><span>
</span><span id="line-120"></span><span>
</span><span id="line-121"></span><span class="hs-comment">-- Note [What is a non-escaping let]</span><span>
</span><span id="line-122"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-123"></span><span class="hs-comment">--</span><span>
</span><span id="line-124"></span><span class="hs-comment">-- NB: Nowadays this is recognized by the occurrence analyser by turning a</span><span>
</span><span id="line-125"></span><span class="hs-comment">-- &quot;non-escaping let&quot; into a join point. The following is then an operational</span><span>
</span><span id="line-126"></span><span class="hs-comment">-- account of join points.</span><span>
</span><span id="line-127"></span><span class="hs-comment">--</span><span>
</span><span id="line-128"></span><span class="hs-comment">-- Consider:</span><span>
</span><span id="line-129"></span><span class="hs-comment">--</span><span>
</span><span id="line-130"></span><span class="hs-comment">--     let x = fvs \ args -&gt; e</span><span>
</span><span id="line-131"></span><span class="hs-comment">--     in</span><span>
</span><span id="line-132"></span><span class="hs-comment">--         if ... then x else</span><span>
</span><span id="line-133"></span><span class="hs-comment">--            if ... then x else ...</span><span>
</span><span id="line-134"></span><span class="hs-comment">--</span><span>
</span><span id="line-135"></span><span class="hs-comment">-- `x' is used twice (so we probably can't unfold it), but when it is</span><span>
</span><span id="line-136"></span><span class="hs-comment">-- entered, the stack is deeper than it was when the definition of `x'</span><span>
</span><span id="line-137"></span><span class="hs-comment">-- happened.  Specifically, if instead of allocating a closure for `x',</span><span>
</span><span id="line-138"></span><span class="hs-comment">-- we saved all `x's fvs on the stack, and remembered the stack depth at</span><span>
</span><span id="line-139"></span><span class="hs-comment">-- that moment, then whenever we enter `x' we can simply set the stack</span><span>
</span><span id="line-140"></span><span class="hs-comment">-- pointer(s) to these remembered (compile-time-fixed) values, and jump</span><span>
</span><span id="line-141"></span><span class="hs-comment">-- to the code for `x'.</span><span>
</span><span id="line-142"></span><span class="hs-comment">--</span><span>
</span><span id="line-143"></span><span class="hs-comment">-- All of this is provided x is:</span><span>
</span><span id="line-144"></span><span class="hs-comment">--   1. non-updatable;</span><span>
</span><span id="line-145"></span><span class="hs-comment">--   2. guaranteed to be entered before the stack retreats -- ie x is not</span><span>
</span><span id="line-146"></span><span class="hs-comment">--      buried in a heap-allocated closure, or passed as an argument to</span><span>
</span><span id="line-147"></span><span class="hs-comment">--      something;</span><span>
</span><span id="line-148"></span><span class="hs-comment">--   3. all the enters have exactly the right number of arguments,</span><span>
</span><span id="line-149"></span><span class="hs-comment">--      no more no less;</span><span>
</span><span id="line-150"></span><span class="hs-comment">--   4. all the enters are tail calls; that is, they return to the</span><span>
</span><span id="line-151"></span><span class="hs-comment">--      caller enclosing the definition of `x'.</span><span>
</span><span id="line-152"></span><span class="hs-comment">--</span><span>
</span><span id="line-153"></span><span class="hs-comment">-- Under these circumstances we say that `x' is non-escaping.</span><span>
</span><span id="line-154"></span><span class="hs-comment">--</span><span>
</span><span id="line-155"></span><span class="hs-comment">-- An example of when (4) does not hold:</span><span>
</span><span id="line-156"></span><span class="hs-comment">--</span><span>
</span><span id="line-157"></span><span class="hs-comment">--     let x = ...</span><span>
</span><span id="line-158"></span><span class="hs-comment">--     in case x of ...alts...</span><span>
</span><span id="line-159"></span><span class="hs-comment">--</span><span>
</span><span id="line-160"></span><span class="hs-comment">-- Here, `x' is certainly entered only when the stack is deeper than when</span><span>
</span><span id="line-161"></span><span class="hs-comment">-- `x' is defined, but here it must return to ...alts... So we can't just</span><span>
</span><span id="line-162"></span><span class="hs-comment">-- adjust the stack down to `x''s recalled points, because that would lost</span><span>
</span><span id="line-163"></span><span class="hs-comment">-- alts' context.</span><span>
</span><span id="line-164"></span><span class="hs-comment">--</span><span>
</span><span id="line-165"></span><span class="hs-comment">-- Things can get a little more complicated.  Consider:</span><span>
</span><span id="line-166"></span><span class="hs-comment">--</span><span>
</span><span id="line-167"></span><span class="hs-comment">--     let y = ...</span><span>
</span><span id="line-168"></span><span class="hs-comment">--     in let x = fvs \ args -&gt; ...y...</span><span>
</span><span id="line-169"></span><span class="hs-comment">--     in ...x...</span><span>
</span><span id="line-170"></span><span class="hs-comment">--</span><span>
</span><span id="line-171"></span><span class="hs-comment">-- Now, if `x' is used in a non-escaping way in ...x..., and `y' is used in a</span><span>
</span><span id="line-172"></span><span class="hs-comment">-- non-escaping way in ...y..., then `y' is non-escaping.</span><span>
</span><span id="line-173"></span><span class="hs-comment">--</span><span>
</span><span id="line-174"></span><span class="hs-comment">-- `x' can even be recursive!  Eg:</span><span>
</span><span id="line-175"></span><span class="hs-comment">--</span><span>
</span><span id="line-176"></span><span class="hs-comment">--     letrec x = [y] \ [v] -&gt; if v then x True else ...</span><span>
</span><span id="line-177"></span><span class="hs-comment">--     in</span><span>
</span><span id="line-178"></span><span class="hs-comment">--         ...(x b)...</span><span>
</span><span id="line-179"></span><span>
</span><span id="line-180"></span><span class="hs-comment">-- Note [Cost-centre initialization plan]</span><span>
</span><span id="line-181"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-182"></span><span class="hs-comment">--</span><span>
</span><span id="line-183"></span><span class="hs-comment">-- Previously `coreToStg` was initializing cost-centre stack fields as `noCCS`,</span><span>
</span><span id="line-184"></span><span class="hs-comment">-- and the fields were then fixed by a separate pass `stgMassageForProfiling`.</span><span>
</span><span id="line-185"></span><span class="hs-comment">-- We now initialize these correctly. The initialization works like this:</span><span>
</span><span id="line-186"></span><span class="hs-comment">--</span><span>
</span><span id="line-187"></span><span class="hs-comment">--   - For non-top level bindings always use `currentCCS`.</span><span>
</span><span id="line-188"></span><span class="hs-comment">--</span><span>
</span><span id="line-189"></span><span class="hs-comment">--   - For top-level bindings, check if the binding is a CAF</span><span>
</span><span id="line-190"></span><span class="hs-comment">--</span><span>
</span><span id="line-191"></span><span class="hs-comment">--     - CAF:      If -fcaf-all is enabled, create a new CAF just for this CAF</span><span>
</span><span id="line-192"></span><span class="hs-comment">--                 and use it. Note that these new cost centres need to be</span><span>
</span><span id="line-193"></span><span class="hs-comment">--                 collected to be able to generate cost centre initialization</span><span>
</span><span id="line-194"></span><span class="hs-comment">--                 code, so `coreToTopStgRhs` now returns `CollectedCCs`.</span><span>
</span><span id="line-195"></span><span class="hs-comment">--</span><span>
</span><span id="line-196"></span><span class="hs-comment">--                 If -fcaf-all is not enabled, use &quot;all CAFs&quot; cost centre.</span><span>
</span><span id="line-197"></span><span class="hs-comment">--</span><span>
</span><span id="line-198"></span><span class="hs-comment">--     - Non-CAF:  Top-level (static) data is not counted in heap profiles; nor</span><span>
</span><span id="line-199"></span><span class="hs-comment">--                 do we set CCCS from it; so we just slam in</span><span>
</span><span id="line-200"></span><span class="hs-comment">--                 dontCareCostCentre.</span><span>
</span><span id="line-201"></span><span>
</span><span id="line-202"></span><span class="hs-comment">-- Note [Coercion tokens]</span><span>
</span><span id="line-203"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-204"></span><span class="hs-comment">-- In coreToStgArgs, we drop type arguments completely, but we replace</span><span>
</span><span id="line-205"></span><span class="hs-comment">-- coercions with a special coercionToken# placeholder. Why? Consider:</span><span>
</span><span id="line-206"></span><span class="hs-comment">--</span><span>
</span><span id="line-207"></span><span class="hs-comment">--   f :: forall a. Int ~# Bool -&gt; a</span><span>
</span><span id="line-208"></span><span class="hs-comment">--   f = /\a. \(co :: Int ~# Bool) -&gt; error &quot;impossible&quot;</span><span>
</span><span id="line-209"></span><span class="hs-comment">--</span><span>
</span><span id="line-210"></span><span class="hs-comment">-- If we erased the coercion argument completely, we&#8217;d end up with just</span><span>
</span><span id="line-211"></span><span class="hs-comment">-- f = error &quot;impossible&quot;, but then f `seq` () would be &#8869;!</span><span>
</span><span id="line-212"></span><span class="hs-comment">--</span><span>
</span><span id="line-213"></span><span class="hs-comment">-- This is an artificial example, but back in the day we *did* treat</span><span>
</span><span id="line-214"></span><span class="hs-comment">-- coercion lambdas like type lambdas, and we had bug reports as a</span><span>
</span><span id="line-215"></span><span class="hs-comment">-- result. So now we treat coercion lambdas like value lambdas, but we</span><span>
</span><span id="line-216"></span><span class="hs-comment">-- treat coercions themselves as zero-width arguments &#8212; coercionToken#</span><span>
</span><span id="line-217"></span><span class="hs-comment">-- has representation VoidRep &#8212; which gets the best of both worlds.</span><span>
</span><span id="line-218"></span><span class="hs-comment">--</span><span>
</span><span id="line-219"></span><span class="hs-comment">-- (For the gory details, see also the (unpublished) paper, &#8220;Practical</span><span>
</span><span id="line-220"></span><span class="hs-comment">-- aspects of evidence-based compilation in System FC.&#8221;)</span><span>
</span><span id="line-221"></span><span>
</span><span id="line-222"></span><span class="hs-comment">-- --------------------------------------------------------------</span><span>
</span><span id="line-223"></span><span class="hs-comment">-- Setting variable info: top-level, binds, RHSs</span><span>
</span><span id="line-224"></span><span class="hs-comment">-- --------------------------------------------------------------</span><span>
</span><span id="line-225"></span><span>
</span><span id="line-226"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToStg"><span class="hs-identifier hs-type">coreToStg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreProgram"><span class="hs-identifier hs-type">CoreProgram</span></a></span><span>
</span><span id="line-227"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgTopBinding"><span class="hs-identifier hs-type">StgTopBinding</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.html#CollectedCCs"><span class="hs-identifier hs-type">CollectedCCs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-228"></span><span id="coreToStg"><span class="annot"><span class="annottext">coreToStg :: DynFlags
-&gt; Module -&gt; CoreProgram -&gt; ([StgTopBinding], CollectedCCs)
</span><a href="GHC.CoreToStg.html#coreToStg"><span class="hs-identifier hs-var hs-var">coreToStg</span></a></span></span><span> </span><span id="local-6989586621680961838"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961838"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680961837"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680961837"><span class="hs-identifier hs-var">this_mod</span></a></span></span><span> </span><span id="local-6989586621680961836"><span class="annot"><span class="annottext">CoreProgram
</span><a href="#local-6989586621680961836"><span class="hs-identifier hs-var">pgm</span></a></span></span><span>
</span><span id="line-229"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[StgTopBinding]
</span><a href="#local-6989586621680961835"><span class="hs-identifier hs-var">pgm'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961834"><span class="hs-identifier hs-var">final_ccs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-230"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-231"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IdEnv HowBound
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680961833"><span class="annot"><span class="annottext">[CostCentre]
</span><a href="#local-6989586621680961833"><span class="hs-identifier hs-var">local_ccs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961832"><span class="annot"><span class="annottext">[CostCentreStack]
</span><a href="#local-6989586621680961832"><span class="hs-identifier hs-var">local_cc_stacks</span></a></span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961835"><span class="annot"><span class="annottext">[StgTopBinding]
</span><a href="#local-6989586621680961835"><span class="hs-identifier hs-var">pgm'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-232"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; Module
-&gt; IdEnv HowBound
-&gt; CollectedCCs
-&gt; CoreProgram
-&gt; (IdEnv HowBound, CollectedCCs, [StgTopBinding])
</span><a href="GHC.CoreToStg.html#coreTopBindsToStg"><span class="hs-identifier hs-var">coreTopBindsToStg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961838"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680961837"><span class="hs-identifier hs-var">this_mod</span></a></span><span> </span><span class="annot"><span class="annottext">IdEnv HowBound
forall a. VarEnv a
</span><a href="GHC.Types.Var.Env.html#emptyVarEnv"><span class="hs-identifier hs-var">emptyVarEnv</span></a></span><span> </span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="GHC.Types.CostCentre.html#emptyCollectedCCs"><span class="hs-identifier hs-var">emptyCollectedCCs</span></a></span><span> </span><span class="annot"><span class="annottext">CoreProgram
</span><a href="#local-6989586621680961836"><span class="hs-identifier hs-var">pgm</span></a></span><span>
</span><span id="line-233"></span><span>
</span><span id="line-234"></span><span>    </span><span id="local-6989586621680961826"><span class="annot"><span class="annottext">prof :: Bool
</span><a href="#local-6989586621680961826"><span class="hs-identifier hs-var hs-var">prof</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Way
</span><a href="GHC.Driver.Ways.html#WayProf"><span class="hs-identifier hs-var">WayProf</span></a></span><span> </span><span class="annot"><span class="annottext">Way -&gt; Set Way -&gt; Bool
forall a. Ord a =&gt; a -&gt; Set a -&gt; Bool
</span><a href="../../containers/src/Data.Set.Internal.html#member"><span class="hs-operator hs-var">`Set.member`</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Set Way
</span><a href="GHC.Driver.Session.html#ways"><span class="hs-identifier hs-var hs-var">ways</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961838"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-235"></span><span>
</span><span id="line-236"></span><span>    </span><span id="local-6989586621680961834"><span class="annot"><span class="annottext">final_ccs :: CollectedCCs
</span><a href="#local-6989586621680961834"><span class="hs-identifier hs-var hs-var">final_ccs</span></a></span></span><span>
</span><span id="line-237"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680961826"><span class="hs-identifier hs-var">prof</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">GeneralFlag -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#gopt"><span class="hs-identifier hs-var">gopt</span></a></span><span> </span><span class="annot"><span class="annottext">GeneralFlag
</span><a href="GHC.Driver.Flags.html#Opt_AutoSccsOnIndividualCafs"><span class="hs-identifier hs-var">Opt_AutoSccsOnIndividualCafs</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961838"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-238"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[CostCentre]
</span><a href="#local-6989586621680961833"><span class="hs-identifier hs-var">local_ccs</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[CostCentreStack]
</span><a href="#local-6989586621680961832"><span class="hs-identifier hs-var">local_cc_stacks</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-comment">-- don't need &quot;all CAFs&quot; CC</span><span>
</span><span id="line-239"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680961826"><span class="hs-identifier hs-var">prof</span></a></span><span>
</span><span id="line-240"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CostCentre
</span><a href="#local-6989586621680961819"><span class="hs-identifier hs-var">all_cafs_cc</span></a></span><span class="annot"><span class="annottext">CostCentre -&gt; [CostCentre] -&gt; [CostCentre]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[CostCentre]
</span><a href="#local-6989586621680961833"><span class="hs-identifier hs-var">local_ccs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621680961818"><span class="hs-identifier hs-var">all_cafs_ccs</span></a></span><span class="annot"><span class="annottext">CostCentreStack -&gt; [CostCentreStack] -&gt; [CostCentreStack]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[CostCentreStack]
</span><a href="#local-6989586621680961832"><span class="hs-identifier hs-var">local_cc_stacks</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-241"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-242"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="GHC.Types.CostCentre.html#emptyCollectedCCs"><span class="hs-identifier hs-var">emptyCollectedCCs</span></a></span><span>
</span><span id="line-243"></span><span>
</span><span id="line-244"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680961819"><span class="annot"><span class="annottext">CostCentre
</span><a href="#local-6989586621680961819"><span class="hs-identifier hs-var">all_cafs_cc</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961818"><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621680961818"><span class="hs-identifier hs-var">all_cafs_ccs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Module -&gt; (CostCentre, CostCentreStack)
</span><a href="GHC.CoreToStg.html#getAllCAFsCC"><span class="hs-identifier hs-var">getAllCAFsCC</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680961837"><span class="hs-identifier hs-var">this_mod</span></a></span><span>
</span><span id="line-245"></span><span>
</span><span id="line-246"></span><span class="annot"><a href="GHC.CoreToStg.html#coreTopBindsToStg"><span class="hs-identifier hs-type">coreTopBindsToStg</span></a></span><span>
</span><span id="line-247"></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span>
</span><span id="line-248"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span>
</span><span id="line-249"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#IdEnv"><span class="hs-identifier hs-type">IdEnv</span></a></span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#HowBound"><span class="hs-identifier hs-type">HowBound</span></a></span><span>           </span><span class="hs-comment">-- environment for the bindings</span><span>
</span><span id="line-250"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.html#CollectedCCs"><span class="hs-identifier hs-type">CollectedCCs</span></a></span><span>
</span><span id="line-251"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreProgram"><span class="hs-identifier hs-type">CoreProgram</span></a></span><span>
</span><span id="line-252"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.Env.html#IdEnv"><span class="hs-identifier hs-type">IdEnv</span></a></span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#HowBound"><span class="hs-identifier hs-type">HowBound</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.html#CollectedCCs"><span class="hs-identifier hs-type">CollectedCCs</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgTopBinding"><span class="hs-identifier hs-type">StgTopBinding</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-253"></span><span>
</span><span id="line-254"></span><span id="coreTopBindsToStg"><span class="annot"><span class="annottext">coreTopBindsToStg :: DynFlags
-&gt; Module
-&gt; IdEnv HowBound
-&gt; CollectedCCs
-&gt; CoreProgram
-&gt; (IdEnv HowBound, CollectedCCs, [StgTopBinding])
</span><a href="GHC.CoreToStg.html#coreTopBindsToStg"><span class="hs-identifier hs-var hs-var">coreTopBindsToStg</span></a></span></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><span class="hs-identifier">_</span></span><span>      </span><span class="annot"><span class="annottext">Module
</span><span class="hs-identifier">_</span></span><span>        </span><span id="local-6989586621680961816"><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961816"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680961815"><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961815"><span class="hs-identifier hs-var">ccs</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-255"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961816"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961815"><span class="hs-identifier hs-var">ccs</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-256"></span><span class="annot"><a href="GHC.CoreToStg.html#coreTopBindsToStg"><span class="hs-identifier hs-var">coreTopBindsToStg</span></a></span><span> </span><span id="local-6989586621680961814"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961814"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680961813"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680961813"><span class="hs-identifier hs-var">this_mod</span></a></span></span><span> </span><span id="local-6989586621680961812"><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961812"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680961811"><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961811"><span class="hs-identifier hs-var">ccs</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680961810"><span class="annot"><span class="annottext">CoreBind
</span><a href="#local-6989586621680961810"><span class="hs-identifier hs-var">b</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680961809"><span class="annot"><span class="annottext">CoreProgram
</span><a href="#local-6989586621680961809"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-257"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Core.html#NonRec"><span class="hs-identifier hs-type">NonRec</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680961807"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961807"><span class="hs-identifier hs-var">rhs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoreBind
</span><a href="#local-6989586621680961810"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoreArg -&gt; Bool
forall b. Expr b -&gt; Bool
</span><a href="GHC.Core.html#isTyCoArg"><span class="hs-identifier hs-var">isTyCoArg</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961807"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-258"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; Module
-&gt; IdEnv HowBound
-&gt; CollectedCCs
-&gt; CoreProgram
-&gt; (IdEnv HowBound, CollectedCCs, [StgTopBinding])
</span><a href="GHC.CoreToStg.html#coreTopBindsToStg"><span class="hs-identifier hs-var">coreTopBindsToStg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961814"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680961813"><span class="hs-identifier hs-var">this_mod</span></a></span><span> </span><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961805"><span class="hs-identifier hs-var">env1</span></a></span><span> </span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961804"><span class="hs-identifier hs-var">ccs1</span></a></span><span> </span><span class="annot"><span class="annottext">CoreProgram
</span><a href="#local-6989586621680961809"><span class="hs-identifier hs-var">bs</span></a></span><span>
</span><span id="line-259"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-260"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961803"><span class="hs-identifier hs-var">env2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961802"><span class="hs-identifier hs-var">ccs2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">StgTopBinding
</span><a href="#local-6989586621680961801"><span class="hs-identifier hs-var">b'</span></a></span><span class="annot"><span class="annottext">StgTopBinding -&gt; [StgTopBinding] -&gt; [StgTopBinding]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[StgTopBinding]
</span><a href="#local-6989586621680961800"><span class="hs-identifier hs-var">bs'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-261"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-262"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680961805"><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961805"><span class="hs-identifier hs-var">env1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961804"><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961804"><span class="hs-identifier hs-var">ccs1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961801"><span class="annot"><span class="annottext">StgTopBinding
</span><a href="#local-6989586621680961801"><span class="hs-identifier hs-var">b'</span></a></span></span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; Module
-&gt; IdEnv HowBound
-&gt; CollectedCCs
-&gt; CoreBind
-&gt; (IdEnv HowBound, CollectedCCs, StgTopBinding)
</span><a href="GHC.CoreToStg.html#coreTopBindToStg"><span class="hs-identifier hs-var">coreTopBindToStg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961814"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680961813"><span class="hs-identifier hs-var">this_mod</span></a></span><span> </span><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961812"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961811"><span class="hs-identifier hs-var">ccs</span></a></span><span> </span><span class="annot"><span class="annottext">CoreBind
</span><a href="#local-6989586621680961810"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-263"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680961803"><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961803"><span class="hs-identifier hs-var">env2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961802"><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961802"><span class="hs-identifier hs-var">ccs2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961800"><span class="annot"><span class="annottext">[StgTopBinding]
</span><a href="#local-6989586621680961800"><span class="hs-identifier hs-var">bs'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; Module
-&gt; IdEnv HowBound
-&gt; CollectedCCs
-&gt; CoreProgram
-&gt; (IdEnv HowBound, CollectedCCs, [StgTopBinding])
</span><a href="GHC.CoreToStg.html#coreTopBindsToStg"><span class="hs-identifier hs-var">coreTopBindsToStg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961814"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680961813"><span class="hs-identifier hs-var">this_mod</span></a></span><span> </span><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961805"><span class="hs-identifier hs-var">env1</span></a></span><span> </span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961804"><span class="hs-identifier hs-var">ccs1</span></a></span><span> </span><span class="annot"><span class="annottext">CoreProgram
</span><a href="#local-6989586621680961809"><span class="hs-identifier hs-var">bs</span></a></span><span>
</span><span id="line-264"></span><span>
</span><span id="line-265"></span><span class="annot"><a href="GHC.CoreToStg.html#coreTopBindToStg"><span class="hs-identifier hs-type">coreTopBindToStg</span></a></span><span>
</span><span id="line-266"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span>
</span><span id="line-267"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span>
</span><span id="line-268"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#IdEnv"><span class="hs-identifier hs-type">IdEnv</span></a></span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#HowBound"><span class="hs-identifier hs-type">HowBound</span></a></span><span>
</span><span id="line-269"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.html#CollectedCCs"><span class="hs-identifier hs-type">CollectedCCs</span></a></span><span>
</span><span id="line-270"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreBind"><span class="hs-identifier hs-type">CoreBind</span></a></span><span>
</span><span id="line-271"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.Env.html#IdEnv"><span class="hs-identifier hs-type">IdEnv</span></a></span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#HowBound"><span class="hs-identifier hs-type">HowBound</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.html#CollectedCCs"><span class="hs-identifier hs-type">CollectedCCs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgTopBinding"><span class="hs-identifier hs-type">StgTopBinding</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-272"></span><span>
</span><span id="line-273"></span><span id="coreTopBindToStg"><span class="annot"><span class="annottext">coreTopBindToStg :: DynFlags
-&gt; Module
-&gt; IdEnv HowBound
-&gt; CollectedCCs
-&gt; CoreBind
-&gt; (IdEnv HowBound, CollectedCCs, StgTopBinding)
</span><a href="GHC.CoreToStg.html#coreTopBindToStg"><span class="hs-identifier hs-var hs-var">coreTopBindToStg</span></a></span></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Module
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680961798"><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961798"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680961797"><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961797"><span class="hs-identifier hs-var">ccs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#NonRec"><span class="hs-identifier hs-type">NonRec</span></a></span><span> </span><span id="local-6989586621680961796"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961796"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span id="local-6989586621680961795"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961795"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-274"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680961794"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621680961794"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoreArg -&gt; Maybe ByteString
</span><a href="GHC.Core.Utils.html#exprIsTickedString_maybe"><span class="hs-identifier hs-var">exprIsTickedString_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961795"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-275"></span><span>  </span><span class="hs-comment">-- top-level string literal</span><span>
</span><span id="line-276"></span><span>  </span><span class="hs-comment">-- See Note [Core top-level string literals] in GHC.Core</span><span>
</span><span id="line-277"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-278"></span><span>        </span><span id="local-6989586621680961793"><span class="annot"><span class="annottext">env' :: IdEnv HowBound
</span><a href="#local-6989586621680961793"><span class="hs-identifier hs-var hs-var">env'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdEnv HowBound -&gt; Id -&gt; HowBound -&gt; IdEnv HowBound
forall a. VarEnv a -&gt; Id -&gt; a -&gt; VarEnv a
</span><a href="GHC.Types.Var.Env.html#extendVarEnv"><span class="hs-identifier hs-var">extendVarEnv</span></a></span><span> </span><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961798"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961796"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">HowBound
</span><a href="#local-6989586621680961791"><span class="hs-identifier hs-var">how_bound</span></a></span><span>
</span><span id="line-279"></span><span>        </span><span id="local-6989586621680961791"><span class="annot"><span class="annottext">how_bound :: HowBound
</span><a href="#local-6989586621680961791"><span class="hs-identifier hs-var hs-var">how_bound</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LetInfo -&gt; JoinArity -&gt; HowBound
</span><a href="GHC.CoreToStg.html#LetBound"><span class="hs-identifier hs-var">LetBound</span></a></span><span> </span><span class="annot"><span class="annottext">LetInfo
</span><a href="GHC.CoreToStg.html#TopLet"><span class="hs-identifier hs-var">TopLet</span></a></span><span> </span><span class="annot"><span class="annottext">JoinArity
</span><span class="hs-number">0</span></span><span>
</span><span id="line-280"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961793"><span class="hs-identifier hs-var">env'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961797"><span class="hs-identifier hs-var">ccs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Id -&gt; ByteString -&gt; StgTopBinding
forall (pass :: StgPass). Id -&gt; ByteString -&gt; GenStgTopBinding pass
</span><a href="GHC.Stg.Syntax.html#StgTopStringLit"><span class="hs-identifier hs-var">StgTopStringLit</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961796"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621680961794"><span class="hs-identifier hs-var">str</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-281"></span><span>
</span><span id="line-282"></span><span class="annot"><a href="GHC.CoreToStg.html#coreTopBindToStg"><span class="hs-identifier hs-var">coreTopBindToStg</span></a></span><span> </span><span id="local-6989586621680961787"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961787"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680961786"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680961786"><span class="hs-identifier hs-var">this_mod</span></a></span></span><span> </span><span id="local-6989586621680961785"><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961785"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680961784"><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961784"><span class="hs-identifier hs-var">ccs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#NonRec"><span class="hs-identifier hs-type">NonRec</span></a></span><span> </span><span id="local-6989586621680961783"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961783"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span id="local-6989586621680961782"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961782"><span class="hs-identifier hs-var">rhs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-283"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-284"></span><span>        </span><span id="local-6989586621680961781"><span class="annot"><span class="annottext">env' :: IdEnv HowBound
</span><a href="#local-6989586621680961781"><span class="hs-identifier hs-var hs-var">env'</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdEnv HowBound -&gt; Id -&gt; HowBound -&gt; IdEnv HowBound
forall a. VarEnv a -&gt; Id -&gt; a -&gt; VarEnv a
</span><a href="GHC.Types.Var.Env.html#extendVarEnv"><span class="hs-identifier hs-var">extendVarEnv</span></a></span><span> </span><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961785"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961783"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">HowBound
</span><a href="#local-6989586621680961780"><span class="hs-identifier hs-var">how_bound</span></a></span><span>
</span><span id="line-285"></span><span>        </span><span id="local-6989586621680961780"><span class="annot"><span class="annottext">how_bound :: HowBound
</span><a href="#local-6989586621680961780"><span class="hs-identifier hs-var hs-var">how_bound</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LetInfo -&gt; JoinArity -&gt; HowBound
</span><a href="GHC.CoreToStg.html#LetBound"><span class="hs-identifier hs-var">LetBound</span></a></span><span> </span><span class="annot"><span class="annottext">LetInfo
</span><a href="GHC.CoreToStg.html#TopLet"><span class="hs-identifier hs-var">TopLet</span></a></span><span> </span><span class="annot"><span class="annottext">(JoinArity -&gt; HowBound) -&gt; JoinArity -&gt; HowBound
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg -&gt; JoinArity
</span><a href="GHC.Core.Opt.Arity.html#manifestArity"><span class="hs-identifier hs-var">manifestArity</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961782"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-286"></span><span>
</span><span id="line-287"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680961778"><span class="annot"><span class="annottext">StgRhs
</span><a href="#local-6989586621680961778"><span class="hs-identifier hs-var">stg_rhs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961777"><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961777"><span class="hs-identifier hs-var">ccs'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-288"></span><span>            </span><span class="annot"><span class="annottext">DynFlags
-&gt; IdEnv HowBound
-&gt; CtsM (StgRhs, CollectedCCs)
-&gt; (StgRhs, CollectedCCs)
forall a. DynFlags -&gt; IdEnv HowBound -&gt; CtsM a -&gt; a
</span><a href="GHC.CoreToStg.html#initCts"><span class="hs-identifier hs-var">initCts</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961787"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961785"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">(CtsM (StgRhs, CollectedCCs) -&gt; (StgRhs, CollectedCCs))
-&gt; CtsM (StgRhs, CollectedCCs) -&gt; (StgRhs, CollectedCCs)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-289"></span><span>              </span><span class="annot"><span class="annottext">DynFlags
-&gt; CollectedCCs
-&gt; Module
-&gt; (Id, CoreArg)
-&gt; CtsM (StgRhs, CollectedCCs)
</span><a href="GHC.CoreToStg.html#coreToTopStgRhs"><span class="hs-identifier hs-var">coreToTopStgRhs</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961787"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961784"><span class="hs-identifier hs-var">ccs</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680961786"><span class="hs-identifier hs-var">this_mod</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961783"><span class="hs-identifier hs-var">id</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961782"><span class="hs-identifier hs-var">rhs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-290"></span><span>
</span><span id="line-291"></span><span>        </span><span id="local-6989586621680961774"><span class="annot"><span class="annottext">bind :: StgTopBinding
</span><a href="#local-6989586621680961774"><span class="hs-identifier hs-var hs-var">bind</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GenStgBinding 'Vanilla -&gt; StgTopBinding
forall (pass :: StgPass).
GenStgBinding pass -&gt; GenStgTopBinding pass
</span><a href="GHC.Stg.Syntax.html#StgTopLifted"><span class="hs-identifier hs-var">StgTopLifted</span></a></span><span> </span><span class="annot"><span class="annottext">(GenStgBinding 'Vanilla -&gt; StgTopBinding)
-&gt; GenStgBinding 'Vanilla -&gt; StgTopBinding
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">BinderP 'Vanilla -&gt; StgRhs -&gt; GenStgBinding 'Vanilla
forall (pass :: StgPass).
BinderP pass -&gt; GenStgRhs pass -&gt; GenStgBinding pass
</span><a href="GHC.Stg.Syntax.html#StgNonRec"><span class="hs-identifier hs-var">StgNonRec</span></a></span><span> </span><span class="annot"><span class="annottext">Id
BinderP 'Vanilla
</span><a href="#local-6989586621680961783"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">StgRhs
</span><a href="#local-6989586621680961778"><span class="hs-identifier hs-var">stg_rhs</span></a></span><span>
</span><span id="line-292"></span><span>    </span><span class="hs-keyword">in</span><span>
</span><span id="line-293"></span><span>      </span><span class="hs-comment">-- NB: previously the assertion printed 'rhs' and 'bind'</span><span>
</span><span id="line-294"></span><span>      </span><span class="hs-comment">--     as well as 'id', but that led to a black hole</span><span>
</span><span id="line-295"></span><span>      </span><span class="hs-comment">--     where printing the assertion error tripped the</span><span>
</span><span id="line-296"></span><span>      </span><span class="hs-comment">--     assertion again!</span><span>
</span><span id="line-297"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961781"><span class="hs-identifier hs-var">env'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961777"><span class="hs-identifier hs-var">ccs'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">StgTopBinding
</span><a href="#local-6989586621680961774"><span class="hs-identifier hs-var">bind</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-298"></span><span>
</span><span id="line-299"></span><span class="annot"><a href="GHC.CoreToStg.html#coreTopBindToStg"><span class="hs-identifier hs-var">coreTopBindToStg</span></a></span><span> </span><span id="local-6989586621680961771"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961771"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680961770"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680961770"><span class="hs-identifier hs-var">this_mod</span></a></span></span><span> </span><span id="local-6989586621680961769"><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961769"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680961768"><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961768"><span class="hs-identifier hs-var">ccs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Rec"><span class="hs-identifier hs-type">Rec</span></a></span><span> </span><span id="local-6989586621680961766"><span class="annot"><span class="annottext">[(Id, CoreArg)]
</span><a href="#local-6989586621680961766"><span class="hs-identifier hs-var">pairs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-300"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">not</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">null</span><span> </span><span class="hs-identifier">pairs</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-301"></span><span>    </span><span class="hs-keyword">let</span><span>
</span><span id="line-302"></span><span>        </span><span id="local-6989586621680961761"><span class="annot"><span class="annottext">binders :: [Id]
</span><a href="#local-6989586621680961761"><span class="hs-identifier hs-var hs-var">binders</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Id, CoreArg) -&gt; Id) -&gt; [(Id, CoreArg)] -&gt; [Id]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(Id, CoreArg) -&gt; Id
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">[(Id, CoreArg)]
</span><a href="#local-6989586621680961766"><span class="hs-identifier hs-var">pairs</span></a></span><span>
</span><span id="line-303"></span><span>
</span><span id="line-304"></span><span>        </span><span id="local-6989586621680961760"><span class="annot"><span class="annottext">extra_env' :: [(Id, HowBound)]
</span><a href="#local-6989586621680961760"><span class="hs-identifier hs-var hs-var">extra_env'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961759"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LetInfo -&gt; JoinArity -&gt; HowBound
</span><a href="GHC.CoreToStg.html#LetBound"><span class="hs-identifier hs-var">LetBound</span></a></span><span> </span><span class="annot"><span class="annottext">LetInfo
</span><a href="GHC.CoreToStg.html#TopLet"><span class="hs-identifier hs-var">TopLet</span></a></span><span> </span><span class="annot"><span class="annottext">(JoinArity -&gt; HowBound) -&gt; JoinArity -&gt; HowBound
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg -&gt; JoinArity
</span><a href="GHC.Core.Opt.Arity.html#manifestArity"><span class="hs-identifier hs-var">manifestArity</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961758"><span class="hs-identifier hs-var">rhs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-305"></span><span>                     </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680961759"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961759"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961758"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961758"><span class="hs-identifier hs-var">rhs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(Id, CoreArg)]
</span><a href="#local-6989586621680961766"><span class="hs-identifier hs-var">pairs</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-306"></span><span>        </span><span id="local-6989586621680961757"><span class="annot"><span class="annottext">env' :: IdEnv HowBound
</span><a href="#local-6989586621680961757"><span class="hs-identifier hs-var hs-var">env'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdEnv HowBound -&gt; [(Id, HowBound)] -&gt; IdEnv HowBound
forall a. VarEnv a -&gt; [(Id, a)] -&gt; VarEnv a
</span><a href="GHC.Types.Var.Env.html#extendVarEnvList"><span class="hs-identifier hs-var">extendVarEnvList</span></a></span><span> </span><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961769"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">[(Id, HowBound)]
</span><a href="#local-6989586621680961760"><span class="hs-identifier hs-var">extra_env'</span></a></span><span>
</span><span id="line-307"></span><span>
</span><span id="line-308"></span><span>        </span><span class="hs-comment">-- generate StgTopBindings and CAF cost centres created for CAFs</span><span>
</span><span id="line-309"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680961752"><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961752"><span class="hs-identifier hs-var">ccs'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961751"><span class="annot"><span class="annottext">[StgRhs]
</span><a href="#local-6989586621680961751"><span class="hs-identifier hs-var">stg_rhss</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-310"></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; IdEnv HowBound
-&gt; CtsM (CollectedCCs, [StgRhs])
-&gt; (CollectedCCs, [StgRhs])
forall a. DynFlags -&gt; IdEnv HowBound -&gt; CtsM a -&gt; a
</span><a href="GHC.CoreToStg.html#initCts"><span class="hs-identifier hs-var">initCts</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961771"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961757"><span class="hs-identifier hs-var">env'</span></a></span><span> </span><span class="annot"><span class="annottext">(CtsM (CollectedCCs, [StgRhs]) -&gt; (CollectedCCs, [StgRhs]))
-&gt; CtsM (CollectedCCs, [StgRhs]) -&gt; (CollectedCCs, [StgRhs])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-311"></span><span>               </span><span class="annot"><span class="annottext">(CollectedCCs -&gt; (Id, CoreArg) -&gt; CtsM (CollectedCCs, StgRhs))
-&gt; CollectedCCs -&gt; [(Id, CoreArg)] -&gt; CtsM (CollectedCCs, [StgRhs])
forall (m :: * -&gt; *) acc x y.
Monad m =&gt;
(acc -&gt; x -&gt; m (acc, y)) -&gt; acc -&gt; [x] -&gt; m (acc, [y])
</span><a href="GHC.Utils.Monad.html#mapAccumLM"><span class="hs-identifier hs-var">mapAccumLM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680961749"><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961749"><span class="hs-identifier hs-var">ccs</span></a></span></span><span> </span><span id="local-6989586621680961748"><span class="annot"><span class="annottext">(Id, CoreArg)
</span><a href="#local-6989586621680961748"><span class="hs-identifier hs-var">rhs</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-312"></span><span>                            </span><span class="hs-special">(</span><span id="local-6989586621680961747"><span class="annot"><span class="annottext">StgRhs
</span><a href="#local-6989586621680961747"><span class="hs-identifier hs-var">rhs'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961746"><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961746"><span class="hs-identifier hs-var">ccs'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span>
</span><span id="line-313"></span><span>                              </span><span class="annot"><span class="annottext">DynFlags
-&gt; CollectedCCs
-&gt; Module
-&gt; (Id, CoreArg)
-&gt; CtsM (StgRhs, CollectedCCs)
</span><a href="GHC.CoreToStg.html#coreToTopStgRhs"><span class="hs-identifier hs-var">coreToTopStgRhs</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961771"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961749"><span class="hs-identifier hs-var">ccs</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680961770"><span class="hs-identifier hs-var">this_mod</span></a></span><span> </span><span class="annot"><span class="annottext">(Id, CoreArg)
</span><a href="#local-6989586621680961748"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-314"></span><span>                            </span><span class="annot"><span class="annottext">(CollectedCCs, StgRhs) -&gt; CtsM (CollectedCCs, StgRhs)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961746"><span class="hs-identifier hs-var">ccs'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">StgRhs
</span><a href="#local-6989586621680961747"><span class="hs-identifier hs-var">rhs'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-315"></span><span>                          </span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961768"><span class="hs-identifier hs-var">ccs</span></a></span><span>
</span><span id="line-316"></span><span>                          </span><span class="annot"><span class="annottext">[(Id, CoreArg)]
</span><a href="#local-6989586621680961766"><span class="hs-identifier hs-var">pairs</span></a></span><span>
</span><span id="line-317"></span><span>
</span><span id="line-318"></span><span>        </span><span id="local-6989586621680961745"><span class="annot"><span class="annottext">bind :: StgTopBinding
</span><a href="#local-6989586621680961745"><span class="hs-identifier hs-var hs-var">bind</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GenStgBinding 'Vanilla -&gt; StgTopBinding
forall (pass :: StgPass).
GenStgBinding pass -&gt; GenStgTopBinding pass
</span><a href="GHC.Stg.Syntax.html#StgTopLifted"><span class="hs-identifier hs-var">StgTopLifted</span></a></span><span> </span><span class="annot"><span class="annottext">(GenStgBinding 'Vanilla -&gt; StgTopBinding)
-&gt; GenStgBinding 'Vanilla -&gt; StgTopBinding
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[(BinderP 'Vanilla, StgRhs)] -&gt; GenStgBinding 'Vanilla
forall (pass :: StgPass).
[(BinderP pass, GenStgRhs pass)] -&gt; GenStgBinding pass
</span><a href="GHC.Stg.Syntax.html#StgRec"><span class="hs-identifier hs-var">StgRec</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Id] -&gt; [StgRhs] -&gt; [(Id, StgRhs)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-identifier hs-var">zip</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621680961761"><span class="hs-identifier hs-var">binders</span></a></span><span> </span><span class="annot"><span class="annottext">[StgRhs]
</span><a href="#local-6989586621680961751"><span class="hs-identifier hs-var">stg_rhss</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-319"></span><span>    </span><span class="hs-keyword">in</span><span>
</span><span id="line-320"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961757"><span class="hs-identifier hs-var">env'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961752"><span class="hs-identifier hs-var">ccs'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">StgTopBinding
</span><a href="#local-6989586621680961745"><span class="hs-identifier hs-var">bind</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-321"></span><span>
</span><span id="line-322"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToTopStgRhs"><span class="hs-identifier hs-type">coreToTopStgRhs</span></a></span><span>
</span><span id="line-323"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span>
</span><span id="line-324"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.html#CollectedCCs"><span class="hs-identifier hs-type">CollectedCCs</span></a></span><span>
</span><span id="line-325"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span>
</span><span id="line-326"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-327"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-type">CtsM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRhs"><span class="hs-identifier hs-type">StgRhs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.html#CollectedCCs"><span class="hs-identifier hs-type">CollectedCCs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-328"></span><span>
</span><span id="line-329"></span><span id="coreToTopStgRhs"><span class="annot"><span class="annottext">coreToTopStgRhs :: DynFlags
-&gt; CollectedCCs
-&gt; Module
-&gt; (Id, CoreArg)
-&gt; CtsM (StgRhs, CollectedCCs)
</span><a href="GHC.CoreToStg.html#coreToTopStgRhs"><span class="hs-identifier hs-var hs-var">coreToTopStgRhs</span></a></span></span><span> </span><span id="local-6989586621680961742"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961742"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680961741"><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961741"><span class="hs-identifier hs-var">ccs</span></a></span></span><span> </span><span id="local-6989586621680961740"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680961740"><span class="hs-identifier hs-var">this_mod</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680961739"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961739"><span class="hs-identifier hs-var">bndr</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961738"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961738"><span class="hs-identifier hs-var">rhs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-330"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621680961737"><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961737"><span class="hs-identifier hs-var">new_rhs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoreArg -&gt; CtsM StgExpr
</span><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961738"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-331"></span><span>
</span><span id="line-332"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680961735"><span class="annot"><span class="annottext">StgRhs
</span><a href="#local-6989586621680961735"><span class="hs-identifier hs-var">stg_rhs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961734"><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961734"><span class="hs-identifier hs-var">ccs'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-333"></span><span>               </span><span class="annot"><span class="annottext">DynFlags
-&gt; Module
-&gt; CollectedCCs
-&gt; Id
-&gt; StgExpr
-&gt; (StgRhs, CollectedCCs)
</span><a href="GHC.CoreToStg.html#mkTopStgRhs"><span class="hs-identifier hs-var">mkTopStgRhs</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961742"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680961740"><span class="hs-identifier hs-var">this_mod</span></a></span><span> </span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961741"><span class="hs-identifier hs-var">ccs</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961739"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961737"><span class="hs-identifier hs-var">new_rhs</span></a></span><span>
</span><span id="line-334"></span><span>             </span><span id="local-6989586621680961732"><span class="annot"><span class="annottext">stg_arity :: JoinArity
</span><a href="#local-6989586621680961732"><span class="hs-identifier hs-var hs-var">stg_arity</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-335"></span><span>               </span><span class="annot"><span class="annottext">StgRhs -&gt; JoinArity
</span><a href="GHC.Stg.Syntax.html#stgRhsArity"><span class="hs-identifier hs-var">stgRhsArity</span></a></span><span> </span><span class="annot"><span class="annottext">StgRhs
</span><a href="#local-6989586621680961735"><span class="hs-identifier hs-var">stg_rhs</span></a></span><span>
</span><span id="line-336"></span><span>
</span><span id="line-337"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(StgRhs, CollectedCCs) -&gt; CtsM (StgRhs, CollectedCCs)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">arity_ok</span><span> </span><span class="hs-identifier">stg_arity</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">mk_arity_msg</span><span> </span><span class="hs-identifier">stg_arity</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">stg_rhs</span><span class="hs-special">,</span><span>
</span><span id="line-338"></span><span>                 </span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961734"><span class="hs-identifier hs-var">ccs'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-339"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-340"></span><span>        </span><span class="hs-comment">-- It's vital that the arity on a top-level Id matches</span><span>
</span><span id="line-341"></span><span>        </span><span class="hs-comment">-- the arity of the generated STG binding, else an importing</span><span>
</span><span id="line-342"></span><span>        </span><span class="hs-comment">-- module will use the wrong calling convention</span><span>
</span><span id="line-343"></span><span>        </span><span class="hs-comment">--      (#2844 was an example where this happened)</span><span>
</span><span id="line-344"></span><span>        </span><span class="hs-comment">-- NB1: we can't move the assertion further out without</span><span>
</span><span id="line-345"></span><span>        </span><span class="hs-comment">--      blocking the &quot;knot&quot; tied in coreTopBindsToStg</span><span>
</span><span id="line-346"></span><span>        </span><span class="hs-comment">-- NB2: the arity check is only needed for Ids with External</span><span>
</span><span id="line-347"></span><span>        </span><span class="hs-comment">--      Names, because they are externally visible.  The CorePrep</span><span>
</span><span id="line-348"></span><span>        </span><span class="hs-comment">--      pass introduces &quot;sat&quot; things with Local Names and does</span><span>
</span><span id="line-349"></span><span>        </span><span class="hs-comment">--      not bother to set their Arity info, so don't fail for those</span><span>
</span><span id="line-350"></span><span>    </span><span id="local-6989586621680961730"><span class="annot"><span class="annottext">arity_ok :: JoinArity -&gt; Bool
</span><a href="#local-6989586621680961730"><span class="hs-identifier hs-var hs-var">arity_ok</span></a></span></span><span> </span><span id="local-6989586621680961726"><span class="annot"><span class="annottext">JoinArity
</span><a href="#local-6989586621680961726"><span class="hs-identifier hs-var">stg_arity</span></a></span></span><span>
</span><span id="line-351"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="GHC.Types.Name.html#isExternalName"><span class="hs-identifier hs-var">isExternalName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Name
</span><a href="GHC.Types.Id.html#idName"><span class="hs-identifier hs-var">idName</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961739"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JoinArity
</span><a href="#local-6989586621680961724"><span class="hs-identifier hs-var">id_arity</span></a></span><span> </span><span class="annot"><span class="annottext">JoinArity -&gt; JoinArity -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">JoinArity
</span><a href="#local-6989586621680961726"><span class="hs-identifier hs-var">stg_arity</span></a></span><span>
</span><span id="line-352"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-353"></span><span>    </span><span id="local-6989586621680961724"><span class="annot"><span class="annottext">id_arity :: JoinArity
</span><a href="#local-6989586621680961724"><span class="hs-identifier hs-var hs-var">id_arity</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; JoinArity
</span><a href="GHC.Types.Id.html#idArity"><span class="hs-identifier hs-var">idArity</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961739"><span class="hs-identifier hs-var">bndr</span></a></span><span>
</span><span id="line-354"></span><span>    </span><span id="local-6989586621680961728"><span class="annot"><span class="annottext">mk_arity_msg :: a -&gt; SDoc
</span><a href="#local-6989586621680961728"><span class="hs-identifier hs-var hs-var">mk_arity_msg</span></a></span></span><span> </span><span id="local-6989586621680961718"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680961718"><span class="hs-identifier hs-var">stg_arity</span></a></span></span><span>
</span><span id="line-355"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Id -&gt; SDoc
forall {a}. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961739"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-356"></span><span>                </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Id arity:&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">JoinArity -&gt; SDoc
forall {a}. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">JoinArity
</span><a href="#local-6989586621680961724"><span class="hs-identifier hs-var">id_arity</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-357"></span><span>                </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;STG arity:&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; SDoc
forall {a}. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680961718"><span class="hs-identifier hs-var">stg_arity</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-358"></span><span>
</span><span id="line-359"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-360"></span><span class="hs-comment">-- Expressions</span><span>
</span><span id="line-361"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-362"></span><span>
</span><span id="line-363"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-type">coreToStgExpr</span></a></span><span>
</span><span id="line-364"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-365"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-type">CtsM</span></a></span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgExpr"><span class="hs-identifier hs-type">StgExpr</span></a></span><span>
</span><span id="line-366"></span><span>
</span><span id="line-367"></span><span class="hs-comment">-- The second and third components can be derived in a simple bottom up pass, not</span><span>
</span><span id="line-368"></span><span class="hs-comment">-- dependent on any decisions about which variables will be let-no-escaped or</span><span>
</span><span id="line-369"></span><span class="hs-comment">-- not.  The first component, that is, the decorated expression, may then depend</span><span>
</span><span id="line-370"></span><span class="hs-comment">-- on these components, but it in turn is not scrutinised as the basis for any</span><span>
</span><span id="line-371"></span><span class="hs-comment">-- decisions.  Hence no black holes.</span><span>
</span><span id="line-372"></span><span>
</span><span id="line-373"></span><span class="hs-comment">-- No LitInteger's or LitNatural's should be left by the time this is called.</span><span>
</span><span id="line-374"></span><span class="hs-comment">-- CorePrep should have converted them all to a real core representation.</span><span>
</span><span id="line-375"></span><span id="coreToStgExpr"><span class="annot"><span class="annottext">coreToStgExpr :: CoreArg -&gt; CtsM StgExpr
</span><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var hs-var">coreToStgExpr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Lit"><span class="hs-identifier hs-type">Lit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Literal.html#LitNumber"><span class="hs-identifier hs-type">LitNumber</span></a></span><span> </span><span class="annot"><span class="annottext">LitNumType
</span><a href="GHC.Types.Literal.html#LitNumInteger"><span class="hs-identifier hs-var">LitNumInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; CtsM StgExpr
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;coreToStgExpr: LitInteger&quot;</span></span><span>
</span><span id="line-376"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Lit"><span class="hs-identifier hs-type">Lit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Literal.html#LitNumber"><span class="hs-identifier hs-type">LitNumber</span></a></span><span> </span><span class="annot"><span class="annottext">LitNumType
</span><a href="GHC.Types.Literal.html#LitNumNatural"><span class="hs-identifier hs-var">LitNumNatural</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; CtsM StgExpr
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;coreToStgExpr: LitNatural&quot;</span></span><span>
</span><span id="line-377"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Lit"><span class="hs-identifier hs-type">Lit</span></a></span><span> </span><span id="local-6989586621680961708"><span class="annot"><span class="annottext">Literal
</span><a href="#local-6989586621680961708"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StgExpr -&gt; CtsM StgExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Literal -&gt; StgExpr
forall (pass :: StgPass). Literal -&gt; GenStgExpr pass
</span><a href="GHC.Stg.Syntax.html#StgLit"><span class="hs-identifier hs-var">StgLit</span></a></span><span> </span><span class="annot"><span class="annottext">Literal
</span><a href="#local-6989586621680961708"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-378"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#App"><span class="hs-identifier hs-type">App</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Lit"><span class="hs-identifier hs-type">Lit</span></a></span><span> </span><span class="annot"><span class="annottext">Literal
</span><a href="GHC.Types.Literal.html#LitRubbish"><span class="hs-identifier hs-var">LitRubbish</span></a></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680961704"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961704"><span class="hs-identifier hs-var">_some_unlifted_type</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-379"></span><span>  </span><span class="hs-comment">-- We lower 'LitRubbish' to @()@ here, which is much easier than doing it in</span><span>
</span><span id="line-380"></span><span>  </span><span class="hs-comment">-- a STG to Cmm pass.</span><span>
</span><span id="line-381"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoreArg -&gt; CtsM StgExpr
</span><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreArg
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="GHC.Builtin.Types.html#unitDataConId"><span class="hs-identifier hs-var">unitDataConId</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-382"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span id="local-6989586621680961702"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961702"><span class="hs-identifier hs-var">v</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; [CoreArg] -&gt; [Tickish Id] -&gt; CtsM StgExpr
</span><a href="GHC.CoreToStg.html#coreToStgApp"><span class="hs-identifier hs-var">coreToStgApp</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961702"><span class="hs-identifier hs-var">v</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-383"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-384"></span><span>  </span><span class="hs-comment">-- See Note [Coercion tokens]</span><span>
</span><span id="line-385"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; [CoreArg] -&gt; [Tickish Id] -&gt; CtsM StgExpr
</span><a href="GHC.CoreToStg.html#coreToStgApp"><span class="hs-identifier hs-var">coreToStgApp</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="GHC.Types.Id.Make.html#coercionTokenId"><span class="hs-identifier hs-var">coercionTokenId</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-386"></span><span>
</span><span id="line-387"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span id="local-6989586621680961699"><span class="annot"><span class="annottext">expr :: CoreArg
</span><a href="#local-6989586621680961699"><span class="hs-identifier hs-var">expr</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#App"><span class="hs-identifier hs-type">App</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-388"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; [CoreArg] -&gt; [Tickish Id] -&gt; CtsM StgExpr
</span><a href="GHC.CoreToStg.html#coreToStgApp"><span class="hs-identifier hs-var">coreToStgApp</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961698"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961697"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961696"><span class="hs-identifier hs-var">ticks</span></a></span><span>
</span><span id="line-389"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-390"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680961698"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961698"><span class="hs-identifier hs-var">f</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961697"><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961697"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961696"><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961696"><span class="hs-identifier hs-var">ticks</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoreArg -&gt; (Id, [CoreArg], [Tickish Id])
</span><a href="GHC.CoreToStg.html#myCollectArgs"><span class="hs-identifier hs-var">myCollectArgs</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961699"><span class="hs-identifier hs-var">expr</span></a></span><span>
</span><span id="line-391"></span><span>
</span><span id="line-392"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span id="local-6989586621680961694"><span class="annot"><span class="annottext">expr :: CoreArg
</span><a href="#local-6989586621680961694"><span class="hs-identifier hs-var">expr</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Lam"><span class="hs-identifier hs-type">Lam</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-393"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-394"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680961692"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621680961692"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961691"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961691"><span class="hs-identifier hs-var">body</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoreArg -&gt; ([Id], CoreArg)
</span><a href="GHC.CoreToStg.html#myCollectBinders"><span class="hs-identifier hs-var">myCollectBinders</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961694"><span class="hs-identifier hs-var">expr</span></a></span><span>
</span><span id="line-395"></span><span>        </span><span id="local-6989586621680961689"><span class="annot"><span class="annottext">args' :: [Id]
</span><a href="#local-6989586621680961689"><span class="hs-identifier hs-var hs-var">args'</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; [Id]
</span><a href="GHC.CoreToStg.html#filterStgBinders"><span class="hs-identifier hs-var">filterStgBinders</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621680961692"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-396"></span><span>    </span><span class="hs-keyword">in</span><span>
</span><span id="line-397"></span><span>    </span><span class="annot"><span class="annottext">[(Id, HowBound)] -&gt; CtsM StgExpr -&gt; CtsM StgExpr
forall a. [(Id, HowBound)] -&gt; CtsM a -&gt; CtsM a
</span><a href="GHC.CoreToStg.html#extendVarEnvCts"><span class="hs-identifier hs-var">extendVarEnvCts</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961686"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">HowBound
</span><a href="GHC.CoreToStg.html#LambdaBound"><span class="hs-identifier hs-var">LambdaBound</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621680961686"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961686"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621680961689"><span class="hs-identifier hs-var">args'</span></a></span><span> </span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">(CtsM StgExpr -&gt; CtsM StgExpr) -&gt; CtsM StgExpr -&gt; CtsM StgExpr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-398"></span><span>    </span><span id="local-6989586621680961684"><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961684"><span class="hs-identifier hs-var">body'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoreArg -&gt; CtsM StgExpr
</span><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961691"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-399"></span><span>    </span><span class="hs-keyword">let</span><span>
</span><span id="line-400"></span><span>        </span><span id="local-6989586621680961683"><span class="annot"><span class="annottext">result_expr :: StgExpr
</span><a href="#local-6989586621680961683"><span class="hs-identifier hs-var hs-var">result_expr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; Maybe (NonEmpty Id)
forall a. [a] -&gt; Maybe (NonEmpty a)
</span><a href="../../base/src/Data.List.NonEmpty.html#nonEmpty"><span class="hs-identifier hs-var">nonEmpty</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621680961689"><span class="hs-identifier hs-var">args'</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-401"></span><span>          </span><span class="annot"><span class="annottext">Maybe (NonEmpty Id)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961684"><span class="hs-identifier hs-var">body'</span></a></span><span>
</span><span id="line-402"></span><span>          </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680961682"><span class="annot"><span class="annottext">NonEmpty Id
</span><a href="#local-6989586621680961682"><span class="hs-identifier hs-var">args''</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">NonEmpty (BinderP 'Vanilla) -&gt; StgExpr -&gt; StgExpr
forall (pass :: StgPass).
NonEmpty (BinderP pass) -&gt; StgExpr -&gt; GenStgExpr pass
</span><a href="GHC.Stg.Syntax.html#StgLam"><span class="hs-identifier hs-var">StgLam</span></a></span><span> </span><span class="annot"><span class="annottext">NonEmpty Id
NonEmpty (BinderP 'Vanilla)
</span><a href="#local-6989586621680961682"><span class="hs-identifier hs-var">args''</span></a></span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961684"><span class="hs-identifier hs-var">body'</span></a></span><span>
</span><span id="line-403"></span><span>
</span><span id="line-404"></span><span>    </span><span class="annot"><span class="annottext">StgExpr -&gt; CtsM StgExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961683"><span class="hs-identifier hs-var">result_expr</span></a></span><span>
</span><span id="line-405"></span><span>
</span><span id="line-406"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Tick"><span class="hs-identifier hs-type">Tick</span></a></span><span> </span><span id="local-6989586621680961679"><span class="annot"><span class="annottext">Tickish Id
</span><a href="#local-6989586621680961679"><span class="hs-identifier hs-var">tick</span></a></span></span><span> </span><span id="local-6989586621680961678"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961678"><span class="hs-identifier hs-var">expr</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-407"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Tickish Id
</span><a href="#local-6989586621680961679"><span class="hs-identifier hs-var">tick</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-408"></span><span>         </span><span class="annot"><a href="GHC.Core.html#HpcTick"><span class="hs-identifier hs-type">HpcTick</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">() -&gt; CtsM ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-409"></span><span>         </span><span class="annot"><a href="GHC.Core.html#ProfNote"><span class="hs-identifier hs-type">ProfNote</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">() -&gt; CtsM ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-410"></span><span>         </span><span class="annot"><a href="GHC.Core.html#SourceNote"><span class="hs-identifier hs-type">SourceNote</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">() -&gt; CtsM ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-411"></span><span>         </span><span class="annot"><a href="GHC.Core.html#Breakpoint"><span class="hs-identifier hs-type">Breakpoint</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; CtsM ()
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;coreToStgExpr: breakpoint should not happen&quot;</span></span><span>
</span><span id="line-412"></span><span>       </span><span id="local-6989586621680961673"><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961673"><span class="hs-identifier hs-var">expr2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoreArg -&gt; CtsM StgExpr
</span><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961678"><span class="hs-identifier hs-var">expr</span></a></span><span>
</span><span id="line-413"></span><span>       </span><span class="annot"><span class="annottext">StgExpr -&gt; CtsM StgExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Tickish Id -&gt; StgExpr -&gt; StgExpr
forall (pass :: StgPass).
Tickish Id -&gt; GenStgExpr pass -&gt; GenStgExpr pass
</span><a href="GHC.Stg.Syntax.html#StgTick"><span class="hs-identifier hs-var">StgTick</span></a></span><span> </span><span class="annot"><span class="annottext">Tickish Id
</span><a href="#local-6989586621680961679"><span class="hs-identifier hs-var">tick</span></a></span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961673"><span class="hs-identifier hs-var">expr2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-414"></span><span>
</span><span id="line-415"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Cast"><span class="hs-identifier hs-type">Cast</span></a></span><span> </span><span id="local-6989586621680961670"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961670"><span class="hs-identifier hs-var">expr</span></a></span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-416"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoreArg -&gt; CtsM StgExpr
</span><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961670"><span class="hs-identifier hs-var">expr</span></a></span><span>
</span><span id="line-417"></span><span>
</span><span id="line-418"></span><span class="hs-comment">-- Cases require a little more real work.</span><span>
</span><span id="line-419"></span><span>
</span><span id="line-420"></span><span class="hs-comment">{-
coreToStgExpr (Case scrut _ _ [])
  = coreToStgExpr scrut
    -- See Note [Empty case alternatives] in GHC.Core If the case
    -- alternatives are empty, the scrutinee must diverge or raise an
    -- exception, so we can just dive into it.
    --
    -- Of course this may seg-fault if the scrutinee *does* return.  A
    -- belt-and-braces approach would be to move this case into the
    -- code generator, and put a return point anyway that calls a
    -- runtime system error function.

coreToStgExpr e0@(Case scrut bndr _ [alt]) = do
  | isUnsafeEqualityProof scrut
  , isDeadBinder bndr -- We can only discard the case if the case-binder is dead
                      -- It usually is, but see #18227
  , (_,_,rhs) &lt;- alt
  = coreToStgExpr rhs
    -- See (U2) in Note [Implementing unsafeCoerce] in base:Unsafe.Coerce
-}</span><span>
</span><span id="line-440"></span><span>
</span><span id="line-441"></span><span class="hs-comment">-- The normal case for case-expressions</span><span>
</span><span id="line-442"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Case"><span class="hs-identifier hs-type">Case</span></a></span><span> </span><span id="local-6989586621680961668"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961668"><span class="hs-identifier hs-var">scrut</span></a></span></span><span> </span><span id="local-6989586621680961667"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961667"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680961666"><span class="annot"><span class="annottext">[Alt Id]
</span><a href="#local-6989586621680961666"><span class="hs-identifier hs-var">alts</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-443"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621680961665"><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961665"><span class="hs-identifier hs-var">scrut2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoreArg -&gt; CtsM StgExpr
</span><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961668"><span class="hs-identifier hs-var">scrut</span></a></span><span>
</span><span id="line-444"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621680961664"><span class="annot"><span class="annottext">[(AltCon, [Id], StgExpr)]
</span><a href="#local-6989586621680961664"><span class="hs-identifier hs-var">alts2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(Id, HowBound)]
-&gt; CtsM [(AltCon, [Id], StgExpr)] -&gt; CtsM [(AltCon, [Id], StgExpr)]
forall a. [(Id, HowBound)] -&gt; CtsM a -&gt; CtsM a
</span><a href="GHC.CoreToStg.html#extendVarEnvCts"><span class="hs-identifier hs-var">extendVarEnvCts</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961667"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">HowBound
</span><a href="GHC.CoreToStg.html#LambdaBound"><span class="hs-identifier hs-var">LambdaBound</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Alt Id -&gt; CtsM (AltCon, [Id], StgExpr))
-&gt; [Alt Id] -&gt; CtsM [(AltCon, [Id], StgExpr)]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">Alt Id -&gt; CtsM (AltCon, [Id], StgExpr)
</span><a href="#local-6989586621680961662"><span class="hs-identifier hs-var">vars_alt</span></a></span><span> </span><span class="annot"><span class="annottext">[Alt Id]
</span><a href="#local-6989586621680961666"><span class="hs-identifier hs-var">alts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-445"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">StgExpr -&gt; CtsM StgExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StgExpr
-&gt; BinderP 'Vanilla -&gt; AltType -&gt; [GenStgAlt 'Vanilla] -&gt; StgExpr
forall (pass :: StgPass).
GenStgExpr pass
-&gt; BinderP pass -&gt; AltType -&gt; [GenStgAlt pass] -&gt; GenStgExpr pass
</span><a href="GHC.Stg.Syntax.html#StgCase"><span class="hs-identifier hs-var">StgCase</span></a></span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961665"><span class="hs-identifier hs-var">scrut2</span></a></span><span> </span><span class="annot"><span class="annottext">Id
BinderP 'Vanilla
</span><a href="#local-6989586621680961667"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; [Alt Id] -&gt; AltType
</span><a href="GHC.CoreToStg.html#mkStgAltType"><span class="hs-identifier hs-var">mkStgAltType</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961667"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">[Alt Id]
</span><a href="#local-6989586621680961666"><span class="hs-identifier hs-var">alts</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(AltCon, [Id], StgExpr)]
[GenStgAlt 'Vanilla]
</span><a href="#local-6989586621680961664"><span class="hs-identifier hs-var">alts2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-446"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-447"></span><span>    </span><span class="annot"><a href="#local-6989586621680961662"><span class="hs-identifier hs-type">vars_alt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#AltCon"><span class="hs-identifier hs-type">AltCon</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-type">CtsM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#AltCon"><span class="hs-identifier hs-type">AltCon</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgExpr"><span class="hs-identifier hs-type">StgExpr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-448"></span><span>    </span><span id="local-6989586621680961662"><span class="annot"><span class="annottext">vars_alt :: Alt Id -&gt; CtsM (AltCon, [Id], StgExpr)
</span><a href="#local-6989586621680961662"><span class="hs-identifier hs-var hs-var">vars_alt</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680961658"><span class="annot"><span class="annottext">AltCon
</span><a href="#local-6989586621680961658"><span class="hs-identifier hs-var">con</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961657"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621680961657"><span class="hs-identifier hs-var">binders</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961656"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961656"><span class="hs-identifier hs-var">rhs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-449"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Core.html#DataAlt"><span class="hs-identifier hs-type">DataAlt</span></a></span><span> </span><span id="local-6989586621680961654"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680961654"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">AltCon
</span><a href="#local-6989586621680961658"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680961654"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; DataCon -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="GHC.Builtin.Types.html#unboxedUnitDataCon"><span class="hs-identifier hs-var">unboxedUnitDataCon</span></a></span><span>
</span><span id="line-450"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-comment">-- This case is a bit smelly.</span><span>
</span><span id="line-451"></span><span>        </span><span class="hs-comment">-- See Note [Nullary unboxed tuple] in GHC.Core.Type</span><span>
</span><span id="line-452"></span><span>        </span><span class="hs-comment">-- where a nullary tuple is mapped to (State# World#)</span><span>
</span><span id="line-453"></span><span>        </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">null</span><span> </span><span class="hs-identifier">binders</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-454"></span><span>        </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621680961653"><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961653"><span class="hs-identifier hs-var">rhs2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoreArg -&gt; CtsM StgExpr
</span><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961656"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-455"></span><span>           </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(AltCon, [Id], StgExpr) -&gt; CtsM (AltCon, [Id], StgExpr)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">AltCon
</span><a href="GHC.Core.html#DEFAULT"><span class="hs-identifier hs-var">DEFAULT</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961653"><span class="hs-identifier hs-var">rhs2</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-special">}</span><span>
</span><span id="line-456"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-457"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>     </span><span class="hs-comment">-- Remove type variables</span><span>
</span><span id="line-458"></span><span>            </span><span id="local-6989586621680961651"><span class="annot"><span class="annottext">binders' :: [Id]
</span><a href="#local-6989586621680961651"><span class="hs-identifier hs-var hs-var">binders'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; [Id]
</span><a href="GHC.CoreToStg.html#filterStgBinders"><span class="hs-identifier hs-var">filterStgBinders</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621680961657"><span class="hs-identifier hs-var">binders</span></a></span><span>
</span><span id="line-459"></span><span>        </span><span class="hs-keyword">in</span><span>
</span><span id="line-460"></span><span>        </span><span class="annot"><span class="annottext">[(Id, HowBound)]
-&gt; CtsM (AltCon, [Id], StgExpr) -&gt; CtsM (AltCon, [Id], StgExpr)
forall a. [(Id, HowBound)] -&gt; CtsM a -&gt; CtsM a
</span><a href="GHC.CoreToStg.html#extendVarEnvCts"><span class="hs-identifier hs-var">extendVarEnvCts</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961650"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">HowBound
</span><a href="GHC.CoreToStg.html#LambdaBound"><span class="hs-identifier hs-var">LambdaBound</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621680961650"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961650"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621680961651"><span class="hs-identifier hs-var">binders'</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">(CtsM (AltCon, [Id], StgExpr) -&gt; CtsM (AltCon, [Id], StgExpr))
-&gt; CtsM (AltCon, [Id], StgExpr) -&gt; CtsM (AltCon, [Id], StgExpr)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-461"></span><span>        </span><span id="local-6989586621680961649"><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961649"><span class="hs-identifier hs-var">rhs2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoreArg -&gt; CtsM StgExpr
</span><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961656"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-462"></span><span>        </span><span class="annot"><span class="annottext">(AltCon, [Id], StgExpr) -&gt; CtsM (AltCon, [Id], StgExpr)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">AltCon
</span><a href="#local-6989586621680961658"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621680961651"><span class="hs-identifier hs-var">binders'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961649"><span class="hs-identifier hs-var">rhs2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-463"></span><span>
</span><span id="line-464"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Let"><span class="hs-identifier hs-type">Let</span></a></span><span> </span><span id="local-6989586621680961647"><span class="annot"><span class="annottext">CoreBind
</span><a href="#local-6989586621680961647"><span class="hs-identifier hs-var">bind</span></a></span></span><span> </span><span id="local-6989586621680961646"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961646"><span class="hs-identifier hs-var">body</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-465"></span><span>    </span><span class="annot"><span class="annottext">CoreBind -&gt; CoreArg -&gt; CtsM StgExpr
</span><a href="GHC.CoreToStg.html#coreToStgLet"><span class="hs-identifier hs-var">coreToStgLet</span></a></span><span> </span><span class="annot"><span class="annottext">CoreBind
</span><a href="#local-6989586621680961647"><span class="hs-identifier hs-var">bind</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961646"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-466"></span><span>
</span><span id="line-467"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span id="local-6989586621680961644"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961644"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; CtsM StgExpr
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;coreToStgExpr&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoreArg -&gt; SDoc
forall {a}. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961644"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-468"></span><span>
</span><span id="line-469"></span><span class="annot"><a href="GHC.CoreToStg.html#mkStgAltType"><span class="hs-identifier hs-type">mkStgAltType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#CoreAlt"><span class="hs-identifier hs-type">CoreAlt</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#AltType"><span class="hs-identifier hs-type">AltType</span></a></span><span>
</span><span id="line-470"></span><span id="mkStgAltType"><span class="annot"><span class="annottext">mkStgAltType :: Id -&gt; [Alt Id] -&gt; AltType
</span><a href="GHC.CoreToStg.html#mkStgAltType"><span class="hs-identifier hs-var hs-var">mkStgAltType</span></a></span></span><span> </span><span id="local-6989586621680961641"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961641"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span id="local-6989586621680961640"><span class="annot"><span class="annottext">[Alt Id]
</span><a href="#local-6989586621680961640"><span class="hs-identifier hs-var">alts</span></a></span></span><span>
</span><span id="line-471"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Core.Type.html#isUnboxedTupleType"><span class="hs-identifier hs-var">isUnboxedTupleType</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680961638"><span class="hs-identifier hs-var">bndr_ty</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Core.Type.html#isUnboxedSumType"><span class="hs-identifier hs-var">isUnboxedSumType</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680961638"><span class="hs-identifier hs-var">bndr_ty</span></a></span><span>
</span><span id="line-472"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JoinArity -&gt; AltType
</span><a href="GHC.Stg.Syntax.html#MultiValAlt"><span class="hs-identifier hs-var">MultiValAlt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[PrimRep] -&gt; JoinArity
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; JoinArity
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[PrimRep]
</span><a href="#local-6989586621680961633"><span class="hs-identifier hs-var">prim_reps</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-comment">-- always use MultiValAlt for unboxed tuples</span><span>
</span><span id="line-473"></span><span>
</span><span id="line-474"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-475"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[PrimRep]
</span><a href="#local-6989586621680961633"><span class="hs-identifier hs-var">prim_reps</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-476"></span><span>      </span><span class="hs-special">[</span><span class="annot"><span class="annottext">PrimRep
</span><a href="GHC.Core.TyCon.html#LiftedRep"><span class="hs-identifier hs-var">LiftedRep</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe TyCon
</span><a href="GHC.Core.Type.html#tyConAppTyCon_maybe"><span class="hs-identifier hs-var">tyConAppTyCon_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; Type
</span><a href="GHC.Types.RepType.html#unwrapType"><span class="hs-identifier hs-var">unwrapType</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680961638"><span class="hs-identifier hs-var">bndr_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-477"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680961629"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680961629"><span class="hs-identifier hs-var">tc</span></a></span></span><span>
</span><span id="line-478"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isAbstractTyCon"><span class="hs-identifier hs-var">isAbstractTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680961629"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">AltType
</span><a href="#local-6989586621680961627"><span class="hs-identifier hs-var">look_for_better_tycon</span></a></span><span>
</span><span id="line-479"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isAlgTyCon"><span class="hs-identifier hs-var">isAlgTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680961629"><span class="hs-identifier hs-var">tc</span></a></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; AltType
</span><a href="GHC.Stg.Syntax.html#AlgAlt"><span class="hs-identifier hs-var">AlgAlt</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680961629"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-480"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">_is_poly_alt_tycon</span><span> </span><span class="hs-identifier">tc</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">tc</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-481"></span><span>                                  </span><span class="annot"><span class="annottext">AltType
</span><a href="GHC.Stg.Syntax.html#PolyAlt"><span class="hs-identifier hs-var">PolyAlt</span></a></span><span>
</span><span id="line-482"></span><span>        </span><span class="annot"><span class="annottext">Maybe TyCon
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">AltType
</span><a href="GHC.Stg.Syntax.html#PolyAlt"><span class="hs-identifier hs-var">PolyAlt</span></a></span><span>
</span><span id="line-483"></span><span>      </span><span class="hs-special">[</span><span id="local-6989586621680961622"><span class="annot"><span class="annottext">PrimRep
</span><a href="#local-6989586621680961622"><span class="hs-identifier hs-var">unlifted</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">PrimRep -&gt; AltType
</span><a href="GHC.Stg.Syntax.html#PrimAlt"><span class="hs-identifier hs-var">PrimAlt</span></a></span><span> </span><span class="annot"><span class="annottext">PrimRep
</span><a href="#local-6989586621680961622"><span class="hs-identifier hs-var">unlifted</span></a></span><span>
</span><span id="line-484"></span><span>      </span><span id="local-6989586621680961620"><span class="annot"><span class="annottext">[PrimRep]
</span><a href="#local-6989586621680961620"><span class="hs-identifier hs-var">not_unary</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">JoinArity -&gt; AltType
</span><a href="GHC.Stg.Syntax.html#MultiValAlt"><span class="hs-identifier hs-var">MultiValAlt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[PrimRep] -&gt; JoinArity
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; JoinArity
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[PrimRep]
</span><a href="#local-6989586621680961620"><span class="hs-identifier hs-var">not_unary</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-485"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-486"></span><span>   </span><span id="local-6989586621680961638"><span class="annot"><span class="annottext">bndr_ty :: Type
</span><a href="#local-6989586621680961638"><span class="hs-identifier hs-var hs-var">bndr_ty</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Type
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961641"><span class="hs-identifier hs-var">bndr</span></a></span><span>
</span><span id="line-487"></span><span>   </span><span id="local-6989586621680961633"><span class="annot"><span class="annottext">prim_reps :: [PrimRep]
</span><a href="#local-6989586621680961633"><span class="hs-identifier hs-var hs-var">prim_reps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; [PrimRep]
Type -&gt; [PrimRep]
</span><a href="GHC.Types.RepType.html#typePrimRep"><span class="hs-identifier hs-var">typePrimRep</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680961638"><span class="hs-identifier hs-var">bndr_ty</span></a></span><span>
</span><span id="line-488"></span><span>
</span><span id="line-489"></span><span>   </span><span id="local-6989586621680961624"><span class="annot"><span class="annottext">_is_poly_alt_tycon :: TyCon -&gt; Bool
</span><a href="#local-6989586621680961624"><span class="hs-identifier hs-var hs-var">_is_poly_alt_tycon</span></a></span></span><span> </span><span id="local-6989586621680961615"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680961615"><span class="hs-identifier hs-var">tc</span></a></span></span><span>
</span><span id="line-490"></span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isFunTyCon"><span class="hs-identifier hs-var">isFunTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680961615"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-491"></span><span>        </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isPrimTyCon"><span class="hs-identifier hs-var">isPrimTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680961615"><span class="hs-identifier hs-var">tc</span></a></span><span>   </span><span class="hs-comment">-- &quot;Any&quot; is lifted but primitive</span><span>
</span><span id="line-492"></span><span>        </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isFamilyTyCon"><span class="hs-identifier hs-var">isFamilyTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680961615"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="hs-comment">-- Type family; e.g. Any, or arising from strict</span><span>
</span><span id="line-493"></span><span>                            </span><span class="hs-comment">-- function application where argument has a</span><span>
</span><span id="line-494"></span><span>                            </span><span class="hs-comment">-- type-family type</span><span>
</span><span id="line-495"></span><span>
</span><span id="line-496"></span><span>   </span><span class="hs-comment">-- Sometimes, the TyCon is a AbstractTyCon which may not have any</span><span>
</span><span id="line-497"></span><span>   </span><span class="hs-comment">-- constructors inside it.  Then we may get a better TyCon by</span><span>
</span><span id="line-498"></span><span>   </span><span class="hs-comment">-- grabbing the one from a constructor alternative</span><span>
</span><span id="line-499"></span><span>   </span><span class="hs-comment">-- if one exists.</span><span>
</span><span id="line-500"></span><span>   </span><span id="local-6989586621680961627"><span class="annot"><span class="annottext">look_for_better_tycon :: AltType
</span><a href="#local-6989586621680961627"><span class="hs-identifier hs-var hs-var">look_for_better_tycon</span></a></span></span><span>
</span><span id="line-501"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#DataAlt"><span class="hs-identifier hs-type">DataAlt</span></a></span><span> </span><span id="local-6989586621680961610"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680961610"><span class="hs-identifier hs-var">con</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Id]
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">[Alt Id]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Alt Id]
</span><a href="#local-6989586621680961609"><span class="hs-identifier hs-var">data_alts</span></a></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-502"></span><span>                </span><span class="annot"><span class="annottext">TyCon -&gt; AltType
</span><a href="GHC.Stg.Syntax.html#AlgAlt"><span class="hs-identifier hs-var">AlgAlt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; TyCon
</span><a href="GHC.Core.DataCon.html#dataConTyCon"><span class="hs-identifier hs-var">dataConTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680961610"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-503"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-504"></span><span>                </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span class="hs-identifier">null</span><span> </span><span class="hs-identifier">data_alts</span><span class="hs-special">)</span><span>
</span><span id="line-505"></span><span>                </span><span class="annot"><span class="annottext">AltType
</span><a href="GHC.Stg.Syntax.html#PolyAlt"><span class="hs-identifier hs-var">PolyAlt</span></a></span><span>
</span><span id="line-506"></span><span>        </span><span class="hs-keyword">where</span><span>
</span><span id="line-507"></span><span>                </span><span class="hs-special">(</span><span id="local-6989586621680961609"><span class="annot"><span class="annottext">[Alt Id]
</span><a href="#local-6989586621680961609"><span class="hs-identifier hs-var">data_alts</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961607"><span class="annot"><span class="annottext">Maybe CoreArg
</span><a href="#local-6989586621680961607"><span class="hs-identifier hs-var">_deflt</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Alt Id] -&gt; ([Alt Id], Maybe CoreArg)
forall a b. [(AltCon, [a], b)] -&gt; ([(AltCon, [a], b)], Maybe b)
</span><a href="GHC.Core.Utils.html#findDefault"><span class="hs-identifier hs-var">findDefault</span></a></span><span> </span><span class="annot"><span class="annottext">[Alt Id]
</span><a href="#local-6989586621680961640"><span class="hs-identifier hs-var">alts</span></a></span><span>
</span><span id="line-508"></span><span>
</span><span id="line-509"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-510"></span><span class="hs-comment">-- Applications</span><span>
</span><span id="line-511"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-512"></span><span>
</span><span id="line-513"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToStgApp"><span class="hs-identifier hs-type">coreToStgApp</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>            </span><span class="hs-comment">-- Function</span><span>
</span><span id="line-514"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#CoreArg"><span class="hs-identifier hs-type">CoreArg</span></a></span><span class="hs-special">]</span><span>     </span><span class="hs-comment">-- Arguments</span><span>
</span><span id="line-515"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#Tickish"><span class="hs-identifier hs-type">Tickish</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span>  </span><span class="hs-comment">-- Debug ticks</span><span>
</span><span id="line-516"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-type">CtsM</span></a></span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgExpr"><span class="hs-identifier hs-type">StgExpr</span></a></span><span>
</span><span id="line-517"></span><span id="coreToStgApp"><span class="annot"><span class="annottext">coreToStgApp :: Id -&gt; [CoreArg] -&gt; [Tickish Id] -&gt; CtsM StgExpr
</span><a href="GHC.CoreToStg.html#coreToStgApp"><span class="hs-identifier hs-var hs-var">coreToStgApp</span></a></span></span><span> </span><span id="local-6989586621680961606"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961606"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680961605"><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961605"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span id="local-6989586621680961604"><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961604"><span class="hs-identifier hs-var">ticks</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-518"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680961603"><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621680961603"><span class="hs-identifier hs-var">args'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961602"><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961602"><span class="hs-identifier hs-var">ticks'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[CoreArg] -&gt; CtsM ([StgArg], [Tickish Id])
</span><a href="GHC.CoreToStg.html#coreToStgArgs"><span class="hs-identifier hs-var">coreToStgArgs</span></a></span><span> </span><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961605"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-519"></span><span>    </span><span id="local-6989586621680961600"><span class="annot"><span class="annottext">HowBound
</span><a href="#local-6989586621680961600"><span class="hs-identifier hs-var">how_bound</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Id -&gt; CtsM HowBound
</span><a href="GHC.CoreToStg.html#lookupVarCts"><span class="hs-identifier hs-var">lookupVarCts</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961606"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-520"></span><span>
</span><span id="line-521"></span><span>    </span><span class="hs-keyword">let</span><span>
</span><span id="line-522"></span><span>        </span><span id="local-6989586621680961598"><span class="annot"><span class="annottext">n_val_args :: JoinArity
</span><a href="#local-6989586621680961598"><span class="hs-identifier hs-var hs-var">n_val_args</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[CoreArg] -&gt; JoinArity
forall b. [Arg b] -&gt; JoinArity
</span><a href="GHC.Core.html#valArgCount"><span class="hs-identifier hs-var">valArgCount</span></a></span><span> </span><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961605"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-523"></span><span>
</span><span id="line-524"></span><span>        </span><span class="hs-comment">-- Mostly, the arity info of a function is in the fn's IdInfo</span><span>
</span><span id="line-525"></span><span>        </span><span class="hs-comment">-- But new bindings introduced by CoreSat may not have no</span><span>
</span><span id="line-526"></span><span>        </span><span class="hs-comment">-- arity info; it would do us no good anyway.  For example:</span><span>
</span><span id="line-527"></span><span>        </span><span class="hs-comment">--      let f = \ab -&gt; e in f</span><span>
</span><span id="line-528"></span><span>        </span><span class="hs-comment">-- No point in having correct arity info for f!</span><span>
</span><span id="line-529"></span><span>        </span><span class="hs-comment">-- Hence the hasArity stuff below.</span><span>
</span><span id="line-530"></span><span>        </span><span class="hs-comment">-- NB: f_arity is only consulted for LetBound things</span><span>
</span><span id="line-531"></span><span>        </span><span id="local-6989586621680961596"><span class="annot"><span class="annottext">f_arity :: JoinArity
</span><a href="#local-6989586621680961596"><span class="hs-identifier hs-var hs-var">f_arity</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; HowBound -&gt; JoinArity
</span><a href="GHC.CoreToStg.html#stgArity"><span class="hs-identifier hs-var">stgArity</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961606"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">HowBound
</span><a href="#local-6989586621680961600"><span class="hs-identifier hs-var">how_bound</span></a></span><span>
</span><span id="line-532"></span><span>        </span><span id="local-6989586621680961592"><span class="annot"><span class="annottext">saturated :: Bool
</span><a href="#local-6989586621680961592"><span class="hs-identifier hs-var hs-var">saturated</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JoinArity
</span><a href="#local-6989586621680961596"><span class="hs-identifier hs-var">f_arity</span></a></span><span> </span><span class="annot"><span class="annottext">JoinArity -&gt; JoinArity -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">JoinArity
</span><a href="#local-6989586621680961598"><span class="hs-identifier hs-var">n_val_args</span></a></span><span>
</span><span id="line-533"></span><span>
</span><span id="line-534"></span><span>        </span><span id="local-6989586621680961590"><span class="annot"><span class="annottext">res_ty :: Type
</span><a href="#local-6989586621680961590"><span class="hs-identifier hs-var hs-var">res_ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoreArg -&gt; Type
</span><a href="GHC.Core.Utils.html#exprType"><span class="hs-identifier hs-var">exprType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoreArg -&gt; [CoreArg] -&gt; CoreArg
forall b. Expr b -&gt; [Expr b] -&gt; Expr b
</span><a href="GHC.Core.html#mkApps"><span class="hs-identifier hs-var">mkApps</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreArg
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961606"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961605"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-535"></span><span>        </span><span id="local-6989586621680961581"><span class="annot"><span class="annottext">app :: GenStgExpr pass
</span><a href="#local-6989586621680961581"><span class="hs-identifier hs-var hs-var">app</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Id -&gt; IdDetails
</span><a href="GHC.Types.Var.html#idDetails"><span class="hs-identifier hs-var">idDetails</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961606"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-536"></span><span>                </span><span class="annot"><a href="GHC.Types.Id.Info.html#DataConWorkId"><span class="hs-identifier hs-type">DataConWorkId</span></a></span><span> </span><span id="local-6989586621680961578"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680961578"><span class="hs-identifier hs-var">dc</span></a></span></span><span>
</span><span id="line-537"></span><span>                  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680961592"><span class="hs-identifier hs-var">saturated</span></a></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; [StgArg] -&gt; [Type] -&gt; GenStgExpr pass
forall (pass :: StgPass).
DataCon -&gt; [StgArg] -&gt; [Type] -&gt; GenStgExpr pass
</span><a href="GHC.Stg.Syntax.html#StgConApp"><span class="hs-identifier hs-var">StgConApp</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680961578"><span class="hs-identifier hs-var">dc</span></a></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621680961603"><span class="hs-identifier hs-var">args'</span></a></span><span>
</span><span id="line-538"></span><span>                                      </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Type] -&gt; [Type]
</span><a href="GHC.Core.Type.html#dropRuntimeRepArgs"><span class="hs-identifier hs-var">dropRuntimeRepArgs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Type] -&gt; Maybe [Type] -&gt; [Type]
forall a. a -&gt; Maybe a -&gt; a
</span><a href="../../base/src/Data.Maybe.html#fromMaybe"><span class="hs-identifier hs-var">fromMaybe</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; Maybe [Type]
</span><a href="GHC.Core.Type.html#tyConAppArgs_maybe"><span class="hs-identifier hs-var">tyConAppArgs_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680961590"><span class="hs-identifier hs-var">res_ty</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-539"></span><span>
</span><span id="line-540"></span><span>                </span><span class="hs-comment">-- Some primitive operator that might be implemented as a library call.</span><span>
</span><span id="line-541"></span><span>                </span><span class="hs-comment">-- As noted by Note [Eta expanding primops] in GHC.Builtin.PrimOps</span><span>
</span><span id="line-542"></span><span>                </span><span class="hs-comment">-- we require that primop applications be saturated.</span><span>
</span><span id="line-543"></span><span>                </span><span class="annot"><a href="GHC.Types.Id.Info.html#PrimOpId"><span class="hs-identifier hs-type">PrimOpId</span></a></span><span> </span><span id="local-6989586621680961573"><span class="annot"><span class="annottext">PrimOp
</span><a href="#local-6989586621680961573"><span class="hs-identifier hs-var">op</span></a></span></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">saturated</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-544"></span><span>                                    </span><span class="annot"><span class="annottext">StgOp -&gt; [StgArg] -&gt; Type -&gt; GenStgExpr pass
forall (pass :: StgPass).
StgOp -&gt; [StgArg] -&gt; Type -&gt; GenStgExpr pass
</span><a href="GHC.Stg.Syntax.html#StgOpApp"><span class="hs-identifier hs-var">StgOpApp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PrimOp -&gt; StgOp
</span><a href="GHC.Stg.Syntax.html#StgPrimOp"><span class="hs-identifier hs-var">StgPrimOp</span></a></span><span> </span><span class="annot"><span class="annottext">PrimOp
</span><a href="#local-6989586621680961573"><span class="hs-identifier hs-var">op</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621680961603"><span class="hs-identifier hs-var">args'</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680961590"><span class="hs-identifier hs-var">res_ty</span></a></span><span>
</span><span id="line-545"></span><span>
</span><span id="line-546"></span><span>                </span><span class="hs-comment">-- A call to some primitive Cmm function.</span><span>
</span><span id="line-547"></span><span>                </span><span class="annot"><a href="GHC.Types.Id.Info.html#FCallId"><span class="hs-identifier hs-type">FCallId</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.ForeignCall.html#CCall"><span class="hs-identifier hs-type">CCall</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.ForeignCall.html#CCallSpec"><span class="hs-identifier hs-type">CCallSpec</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.ForeignCall.html#StaticTarget"><span class="hs-identifier hs-type">StaticTarget</span></a></span><span> </span><span class="annot"><span class="annottext">SourceText
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680961566"><span class="annot"><span class="annottext">CLabelString
</span><a href="#local-6989586621680961566"><span class="hs-identifier hs-var">lbl</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680961565"><span class="annot"><span class="annottext">Unit
</span><a href="#local-6989586621680961565"><span class="hs-identifier hs-var">pkgId</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">)</span><span>
</span><span id="line-548"></span><span>                                          </span><span class="annot"><span class="annottext">CCallConv
</span><a href="GHC.Types.ForeignCall.html#PrimCallConv"><span class="hs-identifier hs-var">PrimCallConv</span></a></span><span> </span><span class="annot"><span class="annottext">Safety
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-549"></span><span>                                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">saturated</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-550"></span><span>                                    </span><span class="annot"><span class="annottext">StgOp -&gt; [StgArg] -&gt; Type -&gt; GenStgExpr pass
forall (pass :: StgPass).
StgOp -&gt; [StgArg] -&gt; Type -&gt; GenStgExpr pass
</span><a href="GHC.Stg.Syntax.html#StgOpApp"><span class="hs-identifier hs-var">StgOpApp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PrimCall -&gt; StgOp
</span><a href="GHC.Stg.Syntax.html#StgPrimCallOp"><span class="hs-identifier hs-var">StgPrimCallOp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CLabelString -&gt; Unit -&gt; PrimCall
</span><a href="GHC.Builtin.PrimOps.html#PrimCall"><span class="hs-identifier hs-var">PrimCall</span></a></span><span> </span><span class="annot"><span class="annottext">CLabelString
</span><a href="#local-6989586621680961566"><span class="hs-identifier hs-var">lbl</span></a></span><span> </span><span class="annot"><span class="annottext">Unit
</span><a href="#local-6989586621680961565"><span class="hs-identifier hs-var">pkgId</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621680961603"><span class="hs-identifier hs-var">args'</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680961590"><span class="hs-identifier hs-var">res_ty</span></a></span><span>
</span><span id="line-551"></span><span>
</span><span id="line-552"></span><span>                </span><span class="hs-comment">-- A regular foreign call.</span><span>
</span><span id="line-553"></span><span>                </span><span class="annot"><a href="GHC.Types.Id.Info.html#FCallId"><span class="hs-identifier hs-type">FCallId</span></a></span><span> </span><span id="local-6989586621680961561"><span class="annot"><span class="annottext">ForeignCall
</span><a href="#local-6989586621680961561"><span class="hs-identifier hs-var">call</span></a></span></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">saturated</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-554"></span><span>                                    </span><span class="annot"><span class="annottext">StgOp -&gt; [StgArg] -&gt; Type -&gt; GenStgExpr pass
forall (pass :: StgPass).
StgOp -&gt; [StgArg] -&gt; Type -&gt; GenStgExpr pass
</span><a href="GHC.Stg.Syntax.html#StgOpApp"><span class="hs-identifier hs-var">StgOpApp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ForeignCall -&gt; Type -&gt; StgOp
</span><a href="GHC.Stg.Syntax.html#StgFCallOp"><span class="hs-identifier hs-var">StgFCallOp</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignCall
</span><a href="#local-6989586621680961561"><span class="hs-identifier hs-var">call</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Type
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961606"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621680961603"><span class="hs-identifier hs-var">args'</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680961590"><span class="hs-identifier hs-var">res_ty</span></a></span><span>
</span><span id="line-555"></span><span>
</span><span id="line-556"></span><span>                </span><span class="annot"><a href="GHC.Types.Id.Info.html#TickBoxOpId"><span class="hs-identifier hs-type">TickBoxOpId</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; GenStgExpr pass
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;coreToStg TickBox&quot;</span></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; GenStgExpr pass) -&gt; SDoc -&gt; GenStgExpr pass
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Id, [StgArg]) -&gt; SDoc
forall {a}. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961606"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621680961603"><span class="hs-identifier hs-var">args'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-557"></span><span>                </span><span id="local-6989586621680961558"><span class="annot"><span class="annottext">IdDetails
</span><a href="#local-6989586621680961558"><span class="hs-identifier hs-var">_other</span></a></span></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Id -&gt; [StgArg] -&gt; GenStgExpr pass
forall (pass :: StgPass). Id -&gt; [StgArg] -&gt; GenStgExpr pass
</span><a href="GHC.Stg.Syntax.html#StgApp"><span class="hs-identifier hs-var">StgApp</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961606"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621680961603"><span class="hs-identifier hs-var">args'</span></a></span><span>
</span><span id="line-558"></span><span>
</span><span id="line-559"></span><span>        </span><span id="local-6989586621680961555"><span class="annot"><span class="annottext">tapp :: GenStgExpr pass
</span><a href="#local-6989586621680961555"><span class="hs-identifier hs-var hs-var">tapp</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Tickish Id -&gt; GenStgExpr pass -&gt; GenStgExpr pass)
-&gt; GenStgExpr pass -&gt; [Tickish Id] -&gt; GenStgExpr pass
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">Tickish Id -&gt; GenStgExpr pass -&gt; GenStgExpr pass
forall (pass :: StgPass).
Tickish Id -&gt; GenStgExpr pass -&gt; GenStgExpr pass
</span><a href="GHC.Stg.Syntax.html#StgTick"><span class="hs-identifier hs-var">StgTick</span></a></span><span> </span><span class="annot"><span class="annottext">GenStgExpr pass
forall {pass :: StgPass}. GenStgExpr pass
</span><a href="#local-6989586621680961581"><span class="hs-identifier hs-var">app</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961604"><span class="hs-identifier hs-var">ticks</span></a></span><span> </span><span class="annot"><span class="annottext">[Tickish Id] -&gt; [Tickish Id] -&gt; [Tickish Id]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961602"><span class="hs-identifier hs-var">ticks'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-560"></span><span>
</span><span id="line-561"></span><span>    </span><span class="hs-comment">-- Forcing these fixes a leak in the code generator, noticed while</span><span>
</span><span id="line-562"></span><span>    </span><span class="hs-comment">-- profiling for trac #4367</span><span>
</span><span id="line-563"></span><span>    </span><span class="annot"><span class="annottext">GenStgExpr Any
forall {pass :: StgPass}. GenStgExpr pass
</span><a href="#local-6989586621680961581"><span class="hs-identifier hs-var">app</span></a></span><span> </span><span class="annot"><span class="annottext">GenStgExpr Any -&gt; CtsM StgExpr -&gt; CtsM StgExpr
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">StgExpr -&gt; CtsM StgExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">StgExpr
forall {pass :: StgPass}. GenStgExpr pass
</span><a href="#local-6989586621680961555"><span class="hs-identifier hs-var">tapp</span></a></span><span>
</span><span id="line-564"></span><span>
</span><span id="line-565"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-566"></span><span class="hs-comment">-- Argument lists</span><span>
</span><span id="line-567"></span><span class="hs-comment">-- This is the guy that turns applications into A-normal form</span><span>
</span><span id="line-568"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-569"></span><span>
</span><span id="line-570"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToStgArgs"><span class="hs-identifier hs-type">coreToStgArgs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#CoreArg"><span class="hs-identifier hs-type">CoreArg</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-type">CtsM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgArg"><span class="hs-identifier hs-type">StgArg</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#Tickish"><span class="hs-identifier hs-type">Tickish</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-571"></span><span id="coreToStgArgs"><span class="annot"><span class="annottext">coreToStgArgs :: [CoreArg] -&gt; CtsM ([StgArg], [Tickish Id])
</span><a href="GHC.CoreToStg.html#coreToStgArgs"><span class="hs-identifier hs-var hs-var">coreToStgArgs</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-572"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([StgArg], [Tickish Id]) -&gt; CtsM ([StgArg], [Tickish Id])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-573"></span><span>
</span><span id="line-574"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToStgArgs"><span class="hs-identifier hs-var">coreToStgArgs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680961552"><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961552"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>     </span><span class="hs-comment">-- Type argument</span><span>
</span><span id="line-575"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680961551"><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621680961551"><span class="hs-identifier hs-var">args'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961550"><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961550"><span class="hs-identifier hs-var">ts</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[CoreArg] -&gt; CtsM ([StgArg], [Tickish Id])
</span><a href="GHC.CoreToStg.html#coreToStgArgs"><span class="hs-identifier hs-var">coreToStgArgs</span></a></span><span> </span><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961552"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-576"></span><span>    </span><span class="annot"><span class="annottext">([StgArg], [Tickish Id]) -&gt; CtsM ([StgArg], [Tickish Id])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621680961551"><span class="hs-identifier hs-var">args'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961550"><span class="hs-identifier hs-var">ts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-577"></span><span>
</span><span id="line-578"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToStgArgs"><span class="hs-identifier hs-var">coreToStgArgs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680961549"><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961549"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Coercion argument; See Note [Coercion tokens]</span><span>
</span><span id="line-579"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680961548"><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621680961548"><span class="hs-identifier hs-var">args'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961547"><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961547"><span class="hs-identifier hs-var">ts</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[CoreArg] -&gt; CtsM ([StgArg], [Tickish Id])
</span><a href="GHC.CoreToStg.html#coreToStgArgs"><span class="hs-identifier hs-var">coreToStgArgs</span></a></span><span> </span><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961549"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-580"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">([StgArg], [Tickish Id]) -&gt; CtsM ([StgArg], [Tickish Id])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; StgArg
</span><a href="GHC.Stg.Syntax.html#StgVarArg"><span class="hs-identifier hs-var">StgVarArg</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="GHC.Types.Id.Make.html#coercionTokenId"><span class="hs-identifier hs-var">coercionTokenId</span></a></span><span> </span><span class="annot"><span class="annottext">StgArg -&gt; [StgArg] -&gt; [StgArg]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621680961548"><span class="hs-identifier hs-var">args'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961547"><span class="hs-identifier hs-var">ts</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-581"></span><span>
</span><span id="line-582"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToStgArgs"><span class="hs-identifier hs-var">coreToStgArgs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Tick"><span class="hs-identifier hs-type">Tick</span></a></span><span> </span><span id="local-6989586621680961545"><span class="annot"><span class="annottext">Tickish Id
</span><a href="#local-6989586621680961545"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span id="local-6989586621680961544"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961544"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680961543"><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961543"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-583"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">not</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">tickishIsCode</span><span> </span><span class="hs-identifier">t</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-584"></span><span>    </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680961541"><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621680961541"><span class="hs-identifier hs-var">args'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961540"><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961540"><span class="hs-identifier hs-var">ts</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[CoreArg] -&gt; CtsM ([StgArg], [Tickish Id])
</span><a href="GHC.CoreToStg.html#coreToStgArgs"><span class="hs-identifier hs-var">coreToStgArgs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961544"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg -&gt; [CoreArg] -&gt; [CoreArg]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961543"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-585"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">([StgArg], [Tickish Id]) -&gt; CtsM ([StgArg], [Tickish Id])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621680961541"><span class="hs-identifier hs-var">args'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Tickish Id
</span><a href="#local-6989586621680961545"><span class="hs-identifier hs-var">t</span></a></span><span class="annot"><span class="annottext">Tickish Id -&gt; [Tickish Id] -&gt; [Tickish Id]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961540"><span class="hs-identifier hs-var">ts</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-586"></span><span>
</span><span id="line-587"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToStgArgs"><span class="hs-identifier hs-var">coreToStgArgs</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680961539"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961539"><span class="hs-identifier hs-var">arg</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680961538"><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961538"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>         </span><span class="hs-comment">-- Non-type argument</span><span>
</span><span id="line-588"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680961537"><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621680961537"><span class="hs-identifier hs-var">stg_args</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961536"><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961536"><span class="hs-identifier hs-var">ticks</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[CoreArg] -&gt; CtsM ([StgArg], [Tickish Id])
</span><a href="GHC.CoreToStg.html#coreToStgArgs"><span class="hs-identifier hs-var">coreToStgArgs</span></a></span><span> </span><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961538"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-589"></span><span>    </span><span id="local-6989586621680961535"><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961535"><span class="hs-identifier hs-var">arg'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoreArg -&gt; CtsM StgExpr
</span><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961539"><span class="hs-identifier hs-var">arg</span></a></span><span>
</span><span id="line-590"></span><span>    </span><span class="hs-keyword">let</span><span>
</span><span id="line-591"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680961534"><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961534"><span class="hs-identifier hs-var">aticks</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961533"><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961533"><span class="hs-identifier hs-var">arg''</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Tickish Id -&gt; Bool) -&gt; StgExpr -&gt; ([Tickish Id], StgExpr)
forall (p :: StgPass).
(Tickish Id -&gt; Bool)
-&gt; GenStgExpr p -&gt; ([Tickish Id], GenStgExpr p)
</span><a href="GHC.Stg.Syntax.html#stripStgTicksTop"><span class="hs-identifier hs-var">stripStgTicksTop</span></a></span><span> </span><span class="annot"><span class="annottext">Tickish Id -&gt; Bool
forall id. Tickish id -&gt; Bool
</span><a href="GHC.Core.html#tickishFloatable"><span class="hs-identifier hs-var">tickishFloatable</span></a></span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961535"><span class="hs-identifier hs-var">arg'</span></a></span><span>
</span><span id="line-592"></span><span>        </span><span id="local-6989586621680961526"><span class="annot"><span class="annottext">stg_arg :: StgArg
</span><a href="#local-6989586621680961526"><span class="hs-identifier hs-var hs-var">stg_arg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961533"><span class="hs-identifier hs-var">arg''</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-593"></span><span>                       </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgApp"><span class="hs-identifier hs-type">StgApp</span></a></span><span> </span><span id="local-6989586621680961525"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961525"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Id -&gt; StgArg
</span><a href="GHC.Stg.Syntax.html#StgVarArg"><span class="hs-identifier hs-var">StgVarArg</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961525"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-594"></span><span>                       </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgConApp"><span class="hs-identifier hs-type">StgConApp</span></a></span><span> </span><span id="local-6989586621680961524"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680961524"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Id -&gt; StgArg
</span><a href="GHC.Stg.Syntax.html#StgVarArg"><span class="hs-identifier hs-var">StgVarArg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; Id
</span><a href="GHC.Core.DataCon.html#dataConWorkId"><span class="hs-identifier hs-var">dataConWorkId</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680961524"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-595"></span><span>                       </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgLit"><span class="hs-identifier hs-type">StgLit</span></a></span><span> </span><span id="local-6989586621680961522"><span class="annot"><span class="annottext">Literal
</span><a href="#local-6989586621680961522"><span class="hs-identifier hs-var">lit</span></a></span></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Literal -&gt; StgArg
</span><a href="GHC.Stg.Syntax.html#StgLitArg"><span class="hs-identifier hs-var">StgLitArg</span></a></span><span> </span><span class="annot"><span class="annottext">Literal
</span><a href="#local-6989586621680961522"><span class="hs-identifier hs-var">lit</span></a></span><span>
</span><span id="line-596"></span><span>                       </span><span class="annot"><span class="annottext">StgExpr
</span><span class="hs-identifier">_</span></span><span>                  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; StgArg
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;coreToStgArgs&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoreArg -&gt; SDoc
forall {a}. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961539"><span class="hs-identifier hs-var">arg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-597"></span><span>
</span><span id="line-598"></span><span>        </span><span class="hs-comment">-- WARNING: what if we have an argument like (v `cast` co)</span><span>
</span><span id="line-599"></span><span>        </span><span class="hs-comment">--          where 'co' changes the representation type?</span><span>
</span><span id="line-600"></span><span>        </span><span class="hs-comment">--          (This really only happens if co is unsafe.)</span><span>
</span><span id="line-601"></span><span>        </span><span class="hs-comment">-- Then all the getArgAmode stuff in CgBindery will set the</span><span>
</span><span id="line-602"></span><span>        </span><span class="hs-comment">-- cg_rep of the CgIdInfo based on the type of v, rather</span><span>
</span><span id="line-603"></span><span>        </span><span class="hs-comment">-- than the type of 'co'.</span><span>
</span><span id="line-604"></span><span>        </span><span class="hs-comment">-- This matters particularly when the function is a primop</span><span>
</span><span id="line-605"></span><span>        </span><span class="hs-comment">-- or foreign call.</span><span>
</span><span id="line-606"></span><span>        </span><span class="hs-comment">-- Wanted: a better solution than this hacky warning</span><span>
</span><span id="line-607"></span><span>
</span><span id="line-608"></span><span>    </span><span id="local-6989586621680961520"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621680961520"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">(DynFlags -&gt; Platform) -&gt; CtsM DynFlags -&gt; CtsM Platform
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">CtsM DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-609"></span><span>    </span><span class="hs-keyword">let</span><span>
</span><span id="line-610"></span><span>        </span><span id="local-6989586621680961515"><span class="annot"><span class="annottext">arg_rep :: [PrimRep]
</span><a href="#local-6989586621680961515"><span class="hs-identifier hs-var hs-var">arg_rep</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; [PrimRep]
Type -&gt; [PrimRep]
</span><a href="GHC.Types.RepType.html#typePrimRep"><span class="hs-identifier hs-var">typePrimRep</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoreArg -&gt; Type
</span><a href="GHC.Core.Utils.html#exprType"><span class="hs-identifier hs-var">exprType</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961539"><span class="hs-identifier hs-var">arg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-611"></span><span>        </span><span id="local-6989586621680961513"><span class="annot"><span class="annottext">stg_arg_rep :: [PrimRep]
</span><a href="#local-6989586621680961513"><span class="hs-identifier hs-var hs-var">stg_arg_rep</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; [PrimRep]
Type -&gt; [PrimRep]
</span><a href="GHC.Types.RepType.html#typePrimRep"><span class="hs-identifier hs-var">typePrimRep</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StgArg -&gt; Type
</span><a href="GHC.Stg.Syntax.html#stgArgType"><span class="hs-identifier hs-var">stgArgType</span></a></span><span> </span><span class="annot"><span class="annottext">StgArg
</span><a href="#local-6989586621680961526"><span class="hs-identifier hs-var">stg_arg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-612"></span><span>        </span><span id="local-6989586621680961511"><span class="annot"><span class="annottext">bad_args :: Bool
</span><a href="#local-6989586621680961511"><span class="hs-identifier hs-var hs-var">bad_args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; [PrimRep] -&gt; [PrimRep] -&gt; Bool
</span><a href="GHC.Core.TyCon.html#primRepsCompatible"><span class="hs-identifier hs-var">primRepsCompatible</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621680961520"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">[PrimRep]
</span><a href="#local-6989586621680961515"><span class="hs-identifier hs-var">arg_rep</span></a></span><span> </span><span class="annot"><span class="annottext">[PrimRep]
</span><a href="#local-6989586621680961513"><span class="hs-identifier hs-var">stg_arg_rep</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-613"></span><span>
</span><span id="line-614"></span><span>    </span><span class="hs-identifier">WARN</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">bad_args</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">text</span><span> </span><span class="hs-string">&quot;Dangerous-looking argument. Probable cause: bad unsafeCoerce#&quot;</span><span> </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">arg</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-615"></span><span>     </span><span class="annot"><span class="annottext">([StgArg], [Tickish Id]) -&gt; CtsM ([StgArg], [Tickish Id])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StgArg
</span><a href="#local-6989586621680961526"><span class="hs-identifier hs-var">stg_arg</span></a></span><span> </span><span class="annot"><span class="annottext">StgArg -&gt; [StgArg] -&gt; [StgArg]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621680961537"><span class="hs-identifier hs-var">stg_args</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961536"><span class="hs-identifier hs-var">ticks</span></a></span><span> </span><span class="annot"><span class="annottext">[Tickish Id] -&gt; [Tickish Id] -&gt; [Tickish Id]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961534"><span class="hs-identifier hs-var">aticks</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-616"></span><span>
</span><span id="line-617"></span><span>
</span><span id="line-618"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-619"></span><span class="hs-comment">-- The magic for lets:</span><span>
</span><span id="line-620"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-621"></span><span>
</span><span id="line-622"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToStgLet"><span class="hs-identifier hs-type">coreToStgLet</span></a></span><span>
</span><span id="line-623"></span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreBind"><span class="hs-identifier hs-type">CoreBind</span></a></span><span>     </span><span class="hs-comment">-- bindings</span><span>
</span><span id="line-624"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>     </span><span class="hs-comment">-- body</span><span>
</span><span id="line-625"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-type">CtsM</span></a></span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgExpr"><span class="hs-identifier hs-type">StgExpr</span></a></span><span> </span><span class="hs-comment">-- new let</span><span>
</span><span id="line-626"></span><span>
</span><span id="line-627"></span><span id="coreToStgLet"><span class="annot"><span class="annottext">coreToStgLet :: CoreBind -&gt; CoreArg -&gt; CtsM StgExpr
</span><a href="GHC.CoreToStg.html#coreToStgLet"><span class="hs-identifier hs-var hs-var">coreToStgLet</span></a></span></span><span> </span><span id="local-6989586621680961507"><span class="annot"><span class="annottext">CoreBind
</span><a href="#local-6989586621680961507"><span class="hs-identifier hs-var">bind</span></a></span></span><span> </span><span id="local-6989586621680961506"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961506"><span class="hs-identifier hs-var">body</span></a></span></span><span>
</span><span id="line-628"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Core.html#NonRec"><span class="hs-identifier hs-type">NonRec</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680961505"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961505"><span class="hs-identifier hs-var">rhs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoreBind
</span><a href="#local-6989586621680961507"><span class="hs-identifier hs-var">bind</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoreArg -&gt; Bool
forall b. Expr b -&gt; Bool
</span><a href="GHC.Core.html#isTyCoArg"><span class="hs-identifier hs-var">isTyCoArg</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961505"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-629"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoreArg -&gt; CtsM StgExpr
</span><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961506"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-630"></span><span>
</span><span id="line-631"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-632"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680961504"><span class="annot"><span class="annottext">GenStgBinding 'Vanilla
</span><a href="#local-6989586621680961504"><span class="hs-identifier hs-var">bind2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961503"><span class="annot"><span class="annottext">[(Id, HowBound)]
</span><a href="#local-6989586621680961503"><span class="hs-identifier hs-var">env_ext</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoreBind -&gt; CtsM (GenStgBinding 'Vanilla, [(Id, HowBound)])
</span><a href="#local-6989586621680961502"><span class="hs-identifier hs-var">vars_bind</span></a></span><span> </span><span class="annot"><span class="annottext">CoreBind
</span><a href="#local-6989586621680961507"><span class="hs-identifier hs-var">bind</span></a></span><span>
</span><span id="line-633"></span><span>
</span><span id="line-634"></span><span>          </span><span class="hs-comment">-- Do the body</span><span>
</span><span id="line-635"></span><span>         </span><span class="hs-special">;</span><span> </span><span id="local-6989586621680961501"><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961501"><span class="hs-identifier hs-var">body2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(Id, HowBound)] -&gt; CtsM StgExpr -&gt; CtsM StgExpr
forall a. [(Id, HowBound)] -&gt; CtsM a -&gt; CtsM a
</span><a href="GHC.CoreToStg.html#extendVarEnvCts"><span class="hs-identifier hs-var">extendVarEnvCts</span></a></span><span> </span><span class="annot"><span class="annottext">[(Id, HowBound)]
</span><a href="#local-6989586621680961503"><span class="hs-identifier hs-var">env_ext</span></a></span><span> </span><span class="annot"><span class="annottext">(CtsM StgExpr -&gt; CtsM StgExpr) -&gt; CtsM StgExpr -&gt; CtsM StgExpr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-636"></span><span>                    </span><span class="annot"><span class="annottext">CoreArg -&gt; CtsM StgExpr
</span><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961506"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-637"></span><span>
</span><span id="line-638"></span><span>        </span><span class="hs-comment">-- Compute the new let-expression</span><span>
</span><span id="line-639"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680961500"><span class="annot"><span class="annottext">new_let :: StgExpr
</span><a href="#local-6989586621680961500"><span class="hs-identifier hs-var hs-var">new_let</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">CoreBind -&gt; Bool
</span><a href="GHC.Core.Utils.html#isJoinBind"><span class="hs-identifier hs-var">isJoinBind</span></a></span><span> </span><span class="annot"><span class="annottext">CoreBind
</span><a href="#local-6989586621680961507"><span class="hs-identifier hs-var">bind</span></a></span><span>
</span><span id="line-640"></span><span>                      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XLetNoEscape 'Vanilla
-&gt; GenStgBinding 'Vanilla -&gt; StgExpr -&gt; StgExpr
forall (pass :: StgPass).
XLetNoEscape pass
-&gt; GenStgBinding pass -&gt; GenStgExpr pass -&gt; GenStgExpr pass
</span><a href="GHC.Stg.Syntax.html#StgLetNoEscape"><span class="hs-identifier hs-var">StgLetNoEscape</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtFieldSilent
XLetNoEscape 'Vanilla
</span><a href="GHC.Stg.Syntax.html#noExtFieldSilent"><span class="hs-identifier hs-var">noExtFieldSilent</span></a></span><span> </span><span class="annot"><span class="annottext">GenStgBinding 'Vanilla
</span><a href="#local-6989586621680961504"><span class="hs-identifier hs-var">bind2</span></a></span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961501"><span class="hs-identifier hs-var">body2</span></a></span><span>
</span><span id="line-641"></span><span>                      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-642"></span><span>                      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XLet 'Vanilla -&gt; GenStgBinding 'Vanilla -&gt; StgExpr -&gt; StgExpr
forall (pass :: StgPass).
XLet pass
-&gt; GenStgBinding pass -&gt; GenStgExpr pass -&gt; GenStgExpr pass
</span><a href="GHC.Stg.Syntax.html#StgLet"><span class="hs-identifier hs-var">StgLet</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtFieldSilent
XLet 'Vanilla
</span><a href="GHC.Stg.Syntax.html#noExtFieldSilent"><span class="hs-identifier hs-var">noExtFieldSilent</span></a></span><span> </span><span class="annot"><span class="annottext">GenStgBinding 'Vanilla
</span><a href="#local-6989586621680961504"><span class="hs-identifier hs-var">bind2</span></a></span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961501"><span class="hs-identifier hs-var">body2</span></a></span><span>
</span><span id="line-643"></span><span>
</span><span id="line-644"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">StgExpr -&gt; CtsM StgExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961500"><span class="hs-identifier hs-var">new_let</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-645"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-646"></span><span>    </span><span id="local-6989586621680961496"><span class="annot"><span class="annottext">mk_binding :: a -&gt; CoreArg -&gt; (a, HowBound)
</span><a href="#local-6989586621680961496"><span class="hs-identifier hs-var hs-var">mk_binding</span></a></span></span><span> </span><span id="local-6989586621680961495"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680961495"><span class="hs-identifier hs-var">binder</span></a></span></span><span> </span><span id="local-6989586621680961494"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961494"><span class="hs-identifier hs-var">rhs</span></a></span></span><span>
</span><span id="line-647"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680961495"><span class="hs-identifier hs-var">binder</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LetInfo -&gt; JoinArity -&gt; HowBound
</span><a href="GHC.CoreToStg.html#LetBound"><span class="hs-identifier hs-var">LetBound</span></a></span><span> </span><span class="annot"><span class="annottext">LetInfo
</span><a href="GHC.CoreToStg.html#NestedLet"><span class="hs-identifier hs-var">NestedLet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoreArg -&gt; JoinArity
</span><a href="GHC.Core.Opt.Arity.html#manifestArity"><span class="hs-identifier hs-var">manifestArity</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961494"><span class="hs-identifier hs-var">rhs</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-648"></span><span>
</span><span id="line-649"></span><span>    </span><span class="annot"><a href="#local-6989586621680961502"><span class="hs-identifier hs-type">vars_bind</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreBind"><span class="hs-identifier hs-type">CoreBind</span></a></span><span>
</span><span id="line-650"></span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-type">CtsM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgBinding"><span class="hs-identifier hs-type">StgBinding</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-651"></span><span>                       </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#HowBound"><span class="hs-identifier hs-type">HowBound</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">)</span><span>  </span><span class="hs-comment">-- extension to environment</span><span>
</span><span id="line-652"></span><span>
</span><span id="line-653"></span><span>    </span><span id="local-6989586621680961502"><span class="annot"><span class="annottext">vars_bind :: CoreBind -&gt; CtsM (GenStgBinding 'Vanilla, [(Id, HowBound)])
</span><a href="#local-6989586621680961502"><span class="hs-identifier hs-var hs-var">vars_bind</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#NonRec"><span class="hs-identifier hs-type">NonRec</span></a></span><span> </span><span id="local-6989586621680961491"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961491"><span class="hs-identifier hs-var">binder</span></a></span></span><span> </span><span id="local-6989586621680961490"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961490"><span class="hs-identifier hs-var">rhs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-654"></span><span>        </span><span id="local-6989586621680961489"><span class="annot"><span class="annottext">StgRhs
</span><a href="#local-6989586621680961489"><span class="hs-identifier hs-var">rhs2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(Id, CoreArg) -&gt; CtsM StgRhs
</span><a href="GHC.CoreToStg.html#coreToStgRhs"><span class="hs-identifier hs-var">coreToStgRhs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961491"><span class="hs-identifier hs-var">binder</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961490"><span class="hs-identifier hs-var">rhs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-655"></span><span>        </span><span class="hs-keyword">let</span><span>
</span><span id="line-656"></span><span>            </span><span id="local-6989586621680961487"><span class="annot"><span class="annottext">env_ext_item :: (Id, HowBound)
</span><a href="#local-6989586621680961487"><span class="hs-identifier hs-var hs-var">env_ext_item</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; CoreArg -&gt; (Id, HowBound)
forall {a}. a -&gt; CoreArg -&gt; (a, HowBound)
</span><a href="#local-6989586621680961496"><span class="hs-identifier hs-var">mk_binding</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961491"><span class="hs-identifier hs-var">binder</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961490"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-657"></span><span>
</span><span id="line-658"></span><span>        </span><span class="annot"><span class="annottext">(GenStgBinding 'Vanilla, [(Id, HowBound)])
-&gt; CtsM (GenStgBinding 'Vanilla, [(Id, HowBound)])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BinderP 'Vanilla -&gt; StgRhs -&gt; GenStgBinding 'Vanilla
forall (pass :: StgPass).
BinderP pass -&gt; GenStgRhs pass -&gt; GenStgBinding pass
</span><a href="GHC.Stg.Syntax.html#StgNonRec"><span class="hs-identifier hs-var">StgNonRec</span></a></span><span> </span><span class="annot"><span class="annottext">Id
BinderP 'Vanilla
</span><a href="#local-6989586621680961491"><span class="hs-identifier hs-var">binder</span></a></span><span> </span><span class="annot"><span class="annottext">StgRhs
</span><a href="#local-6989586621680961489"><span class="hs-identifier hs-var">rhs2</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">(Id, HowBound)
</span><a href="#local-6989586621680961487"><span class="hs-identifier hs-var">env_ext_item</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-659"></span><span>
</span><span id="line-660"></span><span>    </span><span class="annot"><a href="#local-6989586621680961502"><span class="hs-identifier hs-var">vars_bind</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Rec"><span class="hs-identifier hs-type">Rec</span></a></span><span> </span><span id="local-6989586621680961486"><span class="annot"><span class="annottext">[(Id, CoreArg)]
</span><a href="#local-6989586621680961486"><span class="hs-identifier hs-var">pairs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-661"></span><span>      </span><span class="hs-glyph">=</span><span>    </span><span class="hs-keyword">let</span><span>
</span><span id="line-662"></span><span>                </span><span id="local-6989586621680961485"><span class="annot"><span class="annottext">binders :: [Id]
</span><a href="#local-6989586621680961485"><span class="hs-identifier hs-var hs-var">binders</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Id, CoreArg) -&gt; Id) -&gt; [(Id, CoreArg)] -&gt; [Id]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(Id, CoreArg) -&gt; Id
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">[(Id, CoreArg)]
</span><a href="#local-6989586621680961486"><span class="hs-identifier hs-var">pairs</span></a></span><span>
</span><span id="line-663"></span><span>                </span><span id="local-6989586621680961484"><span class="annot"><span class="annottext">env_ext :: [(Id, HowBound)]
</span><a href="#local-6989586621680961484"><span class="hs-identifier hs-var hs-var">env_ext</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Id -&gt; CoreArg -&gt; (Id, HowBound)
forall {a}. a -&gt; CoreArg -&gt; (a, HowBound)
</span><a href="#local-6989586621680961496"><span class="hs-identifier hs-var">mk_binding</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961483"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961482"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-664"></span><span>                          </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680961483"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961483"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680961482"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961482"><span class="hs-identifier hs-var">rhs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(Id, CoreArg)]
</span><a href="#local-6989586621680961486"><span class="hs-identifier hs-var">pairs</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-665"></span><span>           </span><span class="hs-keyword">in</span><span>
</span><span id="line-666"></span><span>           </span><span class="annot"><span class="annottext">[(Id, HowBound)]
-&gt; CtsM (GenStgBinding 'Vanilla, [(Id, HowBound)])
-&gt; CtsM (GenStgBinding 'Vanilla, [(Id, HowBound)])
forall a. [(Id, HowBound)] -&gt; CtsM a -&gt; CtsM a
</span><a href="GHC.CoreToStg.html#extendVarEnvCts"><span class="hs-identifier hs-var">extendVarEnvCts</span></a></span><span> </span><span class="annot"><span class="annottext">[(Id, HowBound)]
</span><a href="#local-6989586621680961484"><span class="hs-identifier hs-var">env_ext</span></a></span><span> </span><span class="annot"><span class="annottext">(CtsM (GenStgBinding 'Vanilla, [(Id, HowBound)])
 -&gt; CtsM (GenStgBinding 'Vanilla, [(Id, HowBound)]))
-&gt; CtsM (GenStgBinding 'Vanilla, [(Id, HowBound)])
-&gt; CtsM (GenStgBinding 'Vanilla, [(Id, HowBound)])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-667"></span><span>              </span><span id="local-6989586621680961481"><span class="annot"><span class="annottext">[StgRhs]
</span><a href="#local-6989586621680961481"><span class="hs-identifier hs-var">rhss2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">((Id, CoreArg) -&gt; CtsM StgRhs) -&gt; [(Id, CoreArg)] -&gt; CtsM [StgRhs]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">(Id, CoreArg) -&gt; CtsM StgRhs
</span><a href="GHC.CoreToStg.html#coreToStgRhs"><span class="hs-identifier hs-var">coreToStgRhs</span></a></span><span> </span><span class="annot"><span class="annottext">[(Id, CoreArg)]
</span><a href="#local-6989586621680961486"><span class="hs-identifier hs-var">pairs</span></a></span><span>
</span><span id="line-668"></span><span>              </span><span class="annot"><span class="annottext">(GenStgBinding 'Vanilla, [(Id, HowBound)])
-&gt; CtsM (GenStgBinding 'Vanilla, [(Id, HowBound)])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(BinderP 'Vanilla, StgRhs)] -&gt; GenStgBinding 'Vanilla
forall (pass :: StgPass).
[(BinderP pass, GenStgRhs pass)] -&gt; GenStgBinding pass
</span><a href="GHC.Stg.Syntax.html#StgRec"><span class="hs-identifier hs-var">StgRec</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621680961485"><span class="hs-identifier hs-var">binders</span></a></span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; [StgRhs] -&gt; [(Id, StgRhs)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-operator hs-var">`zip`</span></a></span><span> </span><span class="annot"><span class="annottext">[StgRhs]
</span><a href="#local-6989586621680961481"><span class="hs-identifier hs-var">rhss2</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[(Id, HowBound)]
</span><a href="#local-6989586621680961484"><span class="hs-identifier hs-var">env_ext</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-669"></span><span>
</span><span id="line-670"></span><span class="annot"><a href="GHC.CoreToStg.html#coreToStgRhs"><span class="hs-identifier hs-type">coreToStgRhs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-671"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-type">CtsM</span></a></span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRhs"><span class="hs-identifier hs-type">StgRhs</span></a></span><span>
</span><span id="line-672"></span><span>
</span><span id="line-673"></span><span id="coreToStgRhs"><span class="annot"><span class="annottext">coreToStgRhs :: (Id, CoreArg) -&gt; CtsM StgRhs
</span><a href="GHC.CoreToStg.html#coreToStgRhs"><span class="hs-identifier hs-var hs-var">coreToStgRhs</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680961480"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961480"><span class="hs-identifier hs-var">bndr</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961479"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961479"><span class="hs-identifier hs-var">rhs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-674"></span><span>    </span><span id="local-6989586621680961478"><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961478"><span class="hs-identifier hs-var">new_rhs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoreArg -&gt; CtsM StgExpr
</span><a href="GHC.CoreToStg.html#coreToStgExpr"><span class="hs-identifier hs-var">coreToStgExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961479"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-675"></span><span>    </span><span class="annot"><span class="annottext">StgRhs -&gt; CtsM StgRhs
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; StgExpr -&gt; StgRhs
</span><a href="GHC.CoreToStg.html#mkStgRhs"><span class="hs-identifier hs-var">mkStgRhs</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961480"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961478"><span class="hs-identifier hs-var">new_rhs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-676"></span><span>
</span><span id="line-677"></span><span class="hs-comment">-- Generate a top-level RHS. Any new cost centres generated for CAFs will be</span><span>
</span><span id="line-678"></span><span class="hs-comment">-- appended to `CollectedCCs` argument.</span><span>
</span><span id="line-679"></span><span class="annot"><a href="GHC.CoreToStg.html#mkTopStgRhs"><span class="hs-identifier hs-type">mkTopStgRhs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.html#CollectedCCs"><span class="hs-identifier hs-type">CollectedCCs</span></a></span><span>
</span><span id="line-680"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgExpr"><span class="hs-identifier hs-type">StgExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRhs"><span class="hs-identifier hs-type">StgRhs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.html#CollectedCCs"><span class="hs-identifier hs-type">CollectedCCs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-681"></span><span>
</span><span id="line-682"></span><span id="mkTopStgRhs"><span class="annot"><span class="annottext">mkTopStgRhs :: DynFlags
-&gt; Module
-&gt; CollectedCCs
-&gt; Id
-&gt; StgExpr
-&gt; (StgRhs, CollectedCCs)
</span><a href="GHC.CoreToStg.html#mkTopStgRhs"><span class="hs-identifier hs-var hs-var">mkTopStgRhs</span></a></span></span><span> </span><span id="local-6989586621680961476"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961476"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680961475"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680961475"><span class="hs-identifier hs-var">this_mod</span></a></span></span><span> </span><span id="local-6989586621680961474"><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961474"><span class="hs-identifier hs-var">ccs</span></a></span></span><span> </span><span id="local-6989586621680961473"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961473"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span id="local-6989586621680961472"><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961472"><span class="hs-identifier hs-var">rhs</span></a></span></span><span>
</span><span id="line-683"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgLam"><span class="hs-identifier hs-type">StgLam</span></a></span><span> </span><span id="local-6989586621680961471"><span class="annot"><span class="annottext">NonEmpty (BinderP 'Vanilla)
</span><a href="#local-6989586621680961471"><span class="hs-identifier hs-var">bndrs</span></a></span></span><span> </span><span id="local-6989586621680961470"><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961470"><span class="hs-identifier hs-var">body</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961472"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-684"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-comment">-- StgLam can't have empty arguments, so not CAF</span><span>
</span><span id="line-685"></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">XRhsClosure 'Vanilla
-&gt; CostCentreStack
-&gt; UpdateFlag
-&gt; [BinderP 'Vanilla]
-&gt; StgExpr
-&gt; StgRhs
forall (pass :: StgPass).
XRhsClosure pass
-&gt; CostCentreStack
-&gt; UpdateFlag
-&gt; [BinderP pass]
-&gt; GenStgExpr pass
-&gt; GenStgRhs pass
</span><a href="GHC.Stg.Syntax.html#StgRhsClosure"><span class="hs-identifier hs-var">StgRhsClosure</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtFieldSilent
XRhsClosure 'Vanilla
</span><a href="GHC.Stg.Syntax.html#noExtFieldSilent"><span class="hs-identifier hs-var">noExtFieldSilent</span></a></span><span>
</span><span id="line-686"></span><span>                    </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="GHC.Types.CostCentre.html#dontCareCCS"><span class="hs-identifier hs-var">dontCareCCS</span></a></span><span>
</span><span id="line-687"></span><span>                    </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="GHC.Stg.Syntax.html#ReEntrant"><span class="hs-identifier hs-var">ReEntrant</span></a></span><span>
</span><span id="line-688"></span><span>                    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">NonEmpty Id -&gt; [Id]
forall a. NonEmpty a -&gt; [a]
</span><a href="../../base/src/Data.List.NonEmpty.html#toList"><span class="hs-identifier hs-var">toList</span></a></span><span> </span><span class="annot"><span class="annottext">NonEmpty Id
NonEmpty (BinderP 'Vanilla)
</span><a href="#local-6989586621680961471"><span class="hs-identifier hs-var">bndrs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961470"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-689"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961474"><span class="hs-identifier hs-var">ccs</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-690"></span><span>
</span><span id="line-691"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgConApp"><span class="hs-identifier hs-type">StgConApp</span></a></span><span> </span><span id="local-6989586621680961466"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680961466"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span id="local-6989586621680961465"><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621680961465"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961464"><span class="hs-identifier hs-var">unticked_rhs</span></a></span><span>
</span><span id="line-692"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- Dynamic StgConApps are updatable</span><span>
</span><span id="line-693"></span><span>    </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Module -&gt; DataCon -&gt; [StgArg] -&gt; Bool
</span><a href="GHC.Stg.Syntax.html#isDllConApp"><span class="hs-identifier hs-var">isDllConApp</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961476"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680961475"><span class="hs-identifier hs-var">this_mod</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680961466"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621680961465"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-694"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-comment">-- CorePrep does this right, but just to make sure</span><span>
</span><span id="line-695"></span><span>    </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">not</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">isUnboxedTupleCon</span><span> </span><span class="hs-identifier">con</span><span> </span><span class="hs-operator">||</span><span> </span><span class="hs-identifier">isUnboxedSumCon</span><span> </span><span class="hs-identifier">con</span><span class="hs-special">)</span><span>
</span><span id="line-696"></span><span>           </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">bndr</span><span> </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">con</span><span> </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">args</span><span class="hs-special">)</span><span>
</span><span id="line-697"></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">CostCentreStack -&gt; DataCon -&gt; [StgArg] -&gt; StgRhs
forall (pass :: StgPass).
CostCentreStack -&gt; DataCon -&gt; [StgArg] -&gt; GenStgRhs pass
</span><a href="GHC.Stg.Syntax.html#StgRhsCon"><span class="hs-identifier hs-var">StgRhsCon</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="GHC.Types.CostCentre.html#dontCareCCS"><span class="hs-identifier hs-var">dontCareCCS</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680961466"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621680961465"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961474"><span class="hs-identifier hs-var">ccs</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-698"></span><span>
</span><span id="line-699"></span><span>  </span><span class="hs-comment">-- Otherwise it's a CAF, see Note [Cost-centre initialization plan].</span><span>
</span><span id="line-700"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">GeneralFlag -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#gopt"><span class="hs-identifier hs-var">gopt</span></a></span><span> </span><span class="annot"><span class="annottext">GeneralFlag
</span><a href="GHC.Driver.Flags.html#Opt_AutoSccsOnIndividualCafs"><span class="hs-identifier hs-var">Opt_AutoSccsOnIndividualCafs</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961476"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-701"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">XRhsClosure 'Vanilla
-&gt; CostCentreStack
-&gt; UpdateFlag
-&gt; [BinderP 'Vanilla]
-&gt; StgExpr
-&gt; StgRhs
forall (pass :: StgPass).
XRhsClosure pass
-&gt; CostCentreStack
-&gt; UpdateFlag
-&gt; [BinderP pass]
-&gt; GenStgExpr pass
-&gt; GenStgRhs pass
</span><a href="GHC.Stg.Syntax.html#StgRhsClosure"><span class="hs-identifier hs-var">StgRhsClosure</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtFieldSilent
XRhsClosure 'Vanilla
</span><a href="GHC.Stg.Syntax.html#noExtFieldSilent"><span class="hs-identifier hs-var">noExtFieldSilent</span></a></span><span>
</span><span id="line-702"></span><span>                    </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621680961459"><span class="hs-identifier hs-var">caf_ccs</span></a></span><span>
</span><span id="line-703"></span><span>                    </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621680961458"><span class="hs-identifier hs-var">upd_flag</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961472"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-704"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CostCentre -&gt; CostCentreStack -&gt; CollectedCCs -&gt; CollectedCCs
</span><a href="GHC.Types.CostCentre.html#collectCC"><span class="hs-identifier hs-var">collectCC</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentre
</span><a href="#local-6989586621680961456"><span class="hs-identifier hs-var">caf_cc</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621680961459"><span class="hs-identifier hs-var">caf_ccs</span></a></span><span> </span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961474"><span class="hs-identifier hs-var">ccs</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-705"></span><span>
</span><span id="line-706"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-707"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">XRhsClosure 'Vanilla
-&gt; CostCentreStack
-&gt; UpdateFlag
-&gt; [BinderP 'Vanilla]
-&gt; StgExpr
-&gt; StgRhs
forall (pass :: StgPass).
XRhsClosure pass
-&gt; CostCentreStack
-&gt; UpdateFlag
-&gt; [BinderP pass]
-&gt; GenStgExpr pass
-&gt; GenStgRhs pass
</span><a href="GHC.Stg.Syntax.html#StgRhsClosure"><span class="hs-identifier hs-var">StgRhsClosure</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtFieldSilent
XRhsClosure 'Vanilla
</span><a href="GHC.Stg.Syntax.html#noExtFieldSilent"><span class="hs-identifier hs-var">noExtFieldSilent</span></a></span><span>
</span><span id="line-708"></span><span>                    </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621680961455"><span class="hs-identifier hs-var">all_cafs_ccs</span></a></span><span>
</span><span id="line-709"></span><span>                    </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621680961458"><span class="hs-identifier hs-var">upd_flag</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961472"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-710"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621680961474"><span class="hs-identifier hs-var">ccs</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-711"></span><span>
</span><span id="line-712"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-713"></span><span>    </span><span id="local-6989586621680961464"><span class="annot"><span class="annottext">unticked_rhs :: StgExpr
</span><a href="#local-6989586621680961464"><span class="hs-identifier hs-var hs-var">unticked_rhs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Tickish Id -&gt; Bool) -&gt; StgExpr -&gt; StgExpr
forall (p :: StgPass).
(Tickish Id -&gt; Bool) -&gt; GenStgExpr p -&gt; GenStgExpr p
</span><a href="GHC.Stg.Syntax.html#stripStgTicksTopE"><span class="hs-identifier hs-var">stripStgTicksTopE</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (Tickish Id -&gt; Bool) -&gt; Tickish Id -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Tickish Id -&gt; Bool
forall id. Tickish id -&gt; Bool
</span><a href="GHC.Core.html#tickishIsCode"><span class="hs-identifier hs-var">tickishIsCode</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961472"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-714"></span><span>
</span><span id="line-715"></span><span>    </span><span id="local-6989586621680961458"><span class="annot"><span class="annottext">upd_flag :: UpdateFlag
</span><a href="#local-6989586621680961458"><span class="hs-identifier hs-var hs-var">upd_flag</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">JointDmd (Str StrDmd) (Use UseDmd) -&gt; Bool
forall s u. JointDmd (Str s) (Use u) -&gt; Bool
</span><a href="GHC.Types.Demand.html#isUsedOnce"><span class="hs-identifier hs-var">isUsedOnce</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; JointDmd (Str StrDmd) (Use UseDmd)
</span><a href="GHC.Types.Id.html#idDemandInfo"><span class="hs-identifier hs-var">idDemandInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961473"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="GHC.Stg.Syntax.html#SingleEntry"><span class="hs-identifier hs-var">SingleEntry</span></a></span><span>
</span><span id="line-716"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="GHC.Stg.Syntax.html#Updatable"><span class="hs-identifier hs-var">Updatable</span></a></span><span>
</span><span id="line-717"></span><span>
</span><span id="line-718"></span><span>    </span><span class="hs-comment">-- CAF cost centres generated for -fcaf-all</span><span>
</span><span id="line-719"></span><span>    </span><span id="local-6989586621680961456"><span class="annot"><span class="annottext">caf_cc :: CostCentre
</span><a href="#local-6989586621680961456"><span class="hs-identifier hs-var hs-var">caf_cc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Module -&gt; CostCentre
</span><a href="GHC.Types.CostCentre.html#mkAutoCC"><span class="hs-identifier hs-var">mkAutoCC</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961473"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680961448"><span class="hs-identifier hs-var">modl</span></a></span><span>
</span><span id="line-720"></span><span>    </span><span id="local-6989586621680961459"><span class="annot"><span class="annottext">caf_ccs :: CostCentreStack
</span><a href="#local-6989586621680961459"><span class="hs-identifier hs-var hs-var">caf_ccs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CostCentre -&gt; CostCentreStack
</span><a href="GHC.Types.CostCentre.html#mkSingletonCCS"><span class="hs-identifier hs-var">mkSingletonCCS</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentre
</span><a href="#local-6989586621680961456"><span class="hs-identifier hs-var">caf_cc</span></a></span><span>
</span><span id="line-721"></span><span>           </span><span class="hs-comment">-- careful: the binder might be :Main.main,</span><span>
</span><span id="line-722"></span><span>           </span><span class="hs-comment">-- which doesn't belong to module mod_name.</span><span>
</span><span id="line-723"></span><span>           </span><span class="hs-comment">-- bug #249, tests prof001, prof002</span><span>
</span><span id="line-724"></span><span>    </span><span id="local-6989586621680961448"><span class="annot"><span class="annottext">modl :: Module
</span><a href="#local-6989586621680961448"><span class="hs-identifier hs-var hs-var">modl</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680961446"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680961446"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Maybe Module
</span><a href="GHC.Types.Name.html#nameModule_maybe"><span class="hs-identifier hs-var">nameModule_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Name
</span><a href="GHC.Types.Id.html#idName"><span class="hs-identifier hs-var">idName</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961473"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680961446"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-725"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680961475"><span class="hs-identifier hs-var">this_mod</span></a></span><span>
</span><span id="line-726"></span><span>
</span><span id="line-727"></span><span>    </span><span class="hs-comment">-- default CAF cost centre</span><span>
</span><span id="line-728"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CostCentre
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680961455"><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621680961455"><span class="hs-identifier hs-var">all_cafs_ccs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Module -&gt; (CostCentre, CostCentreStack)
</span><a href="GHC.CoreToStg.html#getAllCAFsCC"><span class="hs-identifier hs-var">getAllCAFsCC</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680961475"><span class="hs-identifier hs-var">this_mod</span></a></span><span>
</span><span id="line-729"></span><span>
</span><span id="line-730"></span><span class="hs-comment">-- Generate a non-top-level RHS. Cost-centre is always currentCCS,</span><span>
</span><span id="line-731"></span><span class="hs-comment">-- see Note [Cost-centre initialization plan].</span><span>
</span><span id="line-732"></span><span class="annot"><a href="GHC.CoreToStg.html#mkStgRhs"><span class="hs-identifier hs-type">mkStgRhs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgExpr"><span class="hs-identifier hs-type">StgExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRhs"><span class="hs-identifier hs-type">StgRhs</span></a></span><span>
</span><span id="line-733"></span><span id="mkStgRhs"><span class="annot"><span class="annottext">mkStgRhs :: Id -&gt; StgExpr -&gt; StgRhs
</span><a href="GHC.CoreToStg.html#mkStgRhs"><span class="hs-identifier hs-var hs-var">mkStgRhs</span></a></span></span><span> </span><span id="local-6989586621680961445"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961445"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span id="local-6989586621680961444"><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961444"><span class="hs-identifier hs-var">rhs</span></a></span></span><span>
</span><span id="line-734"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgLam"><span class="hs-identifier hs-type">StgLam</span></a></span><span> </span><span id="local-6989586621680961443"><span class="annot"><span class="annottext">NonEmpty (BinderP 'Vanilla)
</span><a href="#local-6989586621680961443"><span class="hs-identifier hs-var">bndrs</span></a></span></span><span> </span><span id="local-6989586621680961442"><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961442"><span class="hs-identifier hs-var">body</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961444"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-735"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XRhsClosure 'Vanilla
-&gt; CostCentreStack
-&gt; UpdateFlag
-&gt; [BinderP 'Vanilla]
-&gt; StgExpr
-&gt; StgRhs
forall (pass :: StgPass).
XRhsClosure pass
-&gt; CostCentreStack
-&gt; UpdateFlag
-&gt; [BinderP pass]
-&gt; GenStgExpr pass
-&gt; GenStgRhs pass
</span><a href="GHC.Stg.Syntax.html#StgRhsClosure"><span class="hs-identifier hs-var">StgRhsClosure</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtFieldSilent
XRhsClosure 'Vanilla
</span><a href="GHC.Stg.Syntax.html#noExtFieldSilent"><span class="hs-identifier hs-var">noExtFieldSilent</span></a></span><span>
</span><span id="line-736"></span><span>                  </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="GHC.Types.CostCentre.html#currentCCS"><span class="hs-identifier hs-var">currentCCS</span></a></span><span>
</span><span id="line-737"></span><span>                  </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="GHC.Stg.Syntax.html#ReEntrant"><span class="hs-identifier hs-var">ReEntrant</span></a></span><span>
</span><span id="line-738"></span><span>                  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">NonEmpty Id -&gt; [Id]
forall a. NonEmpty a -&gt; [a]
</span><a href="../../base/src/Data.List.NonEmpty.html#toList"><span class="hs-identifier hs-var">toList</span></a></span><span> </span><span class="annot"><span class="annottext">NonEmpty Id
NonEmpty (BinderP 'Vanilla)
</span><a href="#local-6989586621680961443"><span class="hs-identifier hs-var">bndrs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961442"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-739"></span><span>
</span><span id="line-740"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Bool
</span><a href="GHC.Types.Id.html#isJoinId"><span class="hs-identifier hs-var">isJoinId</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961445"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="hs-comment">-- must be a nullary join point</span><span>
</span><span id="line-741"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span class="hs-identifier">idJoinArity</span><span> </span><span class="hs-identifier">bndr</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span>
</span><span id="line-742"></span><span>    </span><span class="annot"><span class="annottext">XRhsClosure 'Vanilla
-&gt; CostCentreStack
-&gt; UpdateFlag
-&gt; [BinderP 'Vanilla]
-&gt; StgExpr
-&gt; StgRhs
forall (pass :: StgPass).
XRhsClosure pass
-&gt; CostCentreStack
-&gt; UpdateFlag
-&gt; [BinderP pass]
-&gt; GenStgExpr pass
-&gt; GenStgRhs pass
</span><a href="GHC.Stg.Syntax.html#StgRhsClosure"><span class="hs-identifier hs-var">StgRhsClosure</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtFieldSilent
XRhsClosure 'Vanilla
</span><a href="GHC.Stg.Syntax.html#noExtFieldSilent"><span class="hs-identifier hs-var">noExtFieldSilent</span></a></span><span>
</span><span id="line-743"></span><span>                  </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="GHC.Types.CostCentre.html#currentCCS"><span class="hs-identifier hs-var">currentCCS</span></a></span><span>
</span><span id="line-744"></span><span>                  </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="GHC.Stg.Syntax.html#ReEntrant"><span class="hs-identifier hs-var">ReEntrant</span></a></span><span> </span><span class="hs-comment">-- ignored for LNE</span><span>
</span><span id="line-745"></span><span>                  </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961444"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-746"></span><span>
</span><span id="line-747"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgConApp"><span class="hs-identifier hs-type">StgConApp</span></a></span><span> </span><span id="local-6989586621680961438"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680961438"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span id="local-6989586621680961437"><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621680961437"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961436"><span class="hs-identifier hs-var">unticked_rhs</span></a></span><span>
</span><span id="line-748"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CostCentreStack -&gt; DataCon -&gt; [StgArg] -&gt; StgRhs
forall (pass :: StgPass).
CostCentreStack -&gt; DataCon -&gt; [StgArg] -&gt; GenStgRhs pass
</span><a href="GHC.Stg.Syntax.html#StgRhsCon"><span class="hs-identifier hs-var">StgRhsCon</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="GHC.Types.CostCentre.html#currentCCS"><span class="hs-identifier hs-var">currentCCS</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680961438"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621680961437"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-749"></span><span>
</span><span id="line-750"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-751"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XRhsClosure 'Vanilla
-&gt; CostCentreStack
-&gt; UpdateFlag
-&gt; [BinderP 'Vanilla]
-&gt; StgExpr
-&gt; StgRhs
forall (pass :: StgPass).
XRhsClosure pass
-&gt; CostCentreStack
-&gt; UpdateFlag
-&gt; [BinderP pass]
-&gt; GenStgExpr pass
-&gt; GenStgRhs pass
</span><a href="GHC.Stg.Syntax.html#StgRhsClosure"><span class="hs-identifier hs-var">StgRhsClosure</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtFieldSilent
XRhsClosure 'Vanilla
</span><a href="GHC.Stg.Syntax.html#noExtFieldSilent"><span class="hs-identifier hs-var">noExtFieldSilent</span></a></span><span>
</span><span id="line-752"></span><span>                  </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="GHC.Types.CostCentre.html#currentCCS"><span class="hs-identifier hs-var">currentCCS</span></a></span><span>
</span><span id="line-753"></span><span>                  </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621680961435"><span class="hs-identifier hs-var">upd_flag</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961444"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-754"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-755"></span><span>    </span><span id="local-6989586621680961436"><span class="annot"><span class="annottext">unticked_rhs :: StgExpr
</span><a href="#local-6989586621680961436"><span class="hs-identifier hs-var hs-var">unticked_rhs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Tickish Id -&gt; Bool) -&gt; StgExpr -&gt; StgExpr
forall (p :: StgPass).
(Tickish Id -&gt; Bool) -&gt; GenStgExpr p -&gt; GenStgExpr p
</span><a href="GHC.Stg.Syntax.html#stripStgTicksTopE"><span class="hs-identifier hs-var">stripStgTicksTopE</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (Tickish Id -&gt; Bool) -&gt; Tickish Id -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Tickish Id -&gt; Bool
forall id. Tickish id -&gt; Bool
</span><a href="GHC.Core.html#tickishIsCode"><span class="hs-identifier hs-var">tickishIsCode</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">StgExpr
</span><a href="#local-6989586621680961444"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-756"></span><span>
</span><span id="line-757"></span><span>    </span><span id="local-6989586621680961435"><span class="annot"><span class="annottext">upd_flag :: UpdateFlag
</span><a href="#local-6989586621680961435"><span class="hs-identifier hs-var hs-var">upd_flag</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">JointDmd (Str StrDmd) (Use UseDmd) -&gt; Bool
forall s u. JointDmd (Str s) (Use u) -&gt; Bool
</span><a href="GHC.Types.Demand.html#isUsedOnce"><span class="hs-identifier hs-var">isUsedOnce</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; JointDmd (Str StrDmd) (Use UseDmd)
</span><a href="GHC.Types.Id.html#idDemandInfo"><span class="hs-identifier hs-var">idDemandInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961445"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="GHC.Stg.Syntax.html#SingleEntry"><span class="hs-identifier hs-var">SingleEntry</span></a></span><span>
</span><span id="line-758"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="GHC.Stg.Syntax.html#Updatable"><span class="hs-identifier hs-var">Updatable</span></a></span><span>
</span><span id="line-759"></span><span>
</span><span id="line-760"></span><span>  </span><span class="hs-comment">{-
    SDM: disabled.  Eval/Apply can't handle functions with arity zero very
    well; and making these into simple non-updatable thunks breaks other
    assumptions (namely that they will be entered only once).

    upd_flag | isPAP env rhs  = ReEntrant
             | otherwise      = Updatable

-- Detect thunks which will reduce immediately to PAPs, and make them
-- non-updatable.  This has several advantages:
--
--         - the non-updatable thunk behaves exactly like the PAP,
--
--         - the thunk is more efficient to enter, because it is
--           specialised to the task.
--
--         - we save one update frame, one stg_update_PAP, one update
--           and lots of PAP_enters.
--
--         - in the case where the thunk is top-level, we save building
--           a black hole and furthermore the thunk isn't considered to
--           be a CAF any more, so it doesn't appear in any SRTs.
--
-- We do it here, because the arity information is accurate, and we need
-- to do it before the SRT pass to save the SRT entries associated with
-- any top-level PAPs.

isPAP env (StgApp f args) = listLengthCmp args arity == LT -- idArity f &gt; length args
                              where
                                 arity = stgArity f (lookupBinding env f)
isPAP env _               = False

-}</span><span>
</span><span id="line-793"></span><span>
</span><span id="line-794"></span><span class="hs-comment">{- ToDo:
          upd = if isOnceDem dem
                    then (if isNotTop toplev
                            then SingleEntry    -- HA!  Paydirt for &quot;dem&quot;
                            else
                     (if debugIsOn then trace &quot;WARNING: SE CAFs unsupported, forcing UPD instead&quot; else id) $
                     Updatable)
                else Updatable
        -- For now we forbid SingleEntry CAFs; they tickle the
        -- ASSERT in rts/Storage.c line 215 at newCAF() re mut_link,
        -- and I don't understand why.  There's only one SE_CAF (well,
        -- only one that tickled a great gaping bug in an earlier attempt
        -- at ClosureInfo.getEntryConvention) in the whole of nofib,
        -- specifically Main.lvl6 in spectral/cryptarithm2.
        -- So no great loss.  KSW 2000-07.
-}</span><span>
</span><span id="line-810"></span><span>
</span><span id="line-811"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-812"></span><span class="hs-comment">-- A monad for the core-to-STG pass</span><span>
</span><span id="line-813"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-814"></span><span>
</span><span id="line-815"></span><span class="hs-comment">-- There's a lot of stuff to pass around, so we use this CtsM</span><span>
</span><span id="line-816"></span><span class="hs-comment">-- (&quot;core-to-STG monad&quot;) monad to help.  All the stuff here is only passed</span><span>
</span><span id="line-817"></span><span class="hs-comment">-- *down*.</span><span>
</span><span id="line-818"></span><span>
</span><span id="line-819"></span><span class="hs-keyword">newtype</span><span> </span><span id="CtsM"><span class="annot"><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-var">CtsM</span></a></span></span><span> </span><span id="local-6989586621680962003"><span class="annot"><a href="#local-6989586621680962003"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="CtsM"><span class="annot"><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-var">CtsM</span></a></span></span><span>
</span><span id="line-820"></span><span>    </span><span class="hs-special">{</span><span> </span><span id="unCtsM"><span class="annot"><span class="annottext">forall a. CtsM a -&gt; DynFlags -&gt; IdEnv HowBound -&gt; a
</span><a href="GHC.CoreToStg.html#unCtsM"><span class="hs-identifier hs-var hs-var">unCtsM</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-comment">-- Needed for checking for bad coercions in coreToStgArgs</span><span>
</span><span id="line-821"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#IdEnv"><span class="hs-identifier hs-type">IdEnv</span></a></span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#HowBound"><span class="hs-identifier hs-type">HowBound</span></a></span><span>
</span><span id="line-822"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680962003"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-823"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-824"></span><span>    </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680961429"><span id="local-6989586621680961431"><span class="annot"><span class="annottext">(forall a b. (a -&gt; b) -&gt; CtsM a -&gt; CtsM b)
-&gt; (forall a b. a -&gt; CtsM b -&gt; CtsM a) -&gt; Functor CtsM
forall a b. a -&gt; CtsM b -&gt; CtsM a
forall a b. (a -&gt; b) -&gt; CtsM a -&gt; CtsM b
forall (f :: * -&gt; *).
(forall a b. (a -&gt; b) -&gt; f a -&gt; f b)
-&gt; (forall a b. a -&gt; f b -&gt; f a) -&gt; Functor f
&lt;$ :: forall a b. a -&gt; CtsM b -&gt; CtsM a
$c&lt;$ :: forall a b. a -&gt; CtsM b -&gt; CtsM a
fmap :: forall a b. (a -&gt; b) -&gt; CtsM a -&gt; CtsM b
$cfmap :: forall a b. (a -&gt; b) -&gt; CtsM a -&gt; CtsM b
</span><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Functor</span></a></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-825"></span><span>
</span><span id="line-826"></span><span class="hs-keyword">data</span><span> </span><span id="HowBound"><span class="annot"><a href="GHC.CoreToStg.html#HowBound"><span class="hs-identifier hs-var">HowBound</span></a></span></span><span>
</span><span id="line-827"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="ImportBound"><span class="annot"><a href="GHC.CoreToStg.html#ImportBound"><span class="hs-identifier hs-var">ImportBound</span></a></span></span><span>         </span><span class="hs-comment">-- Used only as a response to lookupBinding; never</span><span>
</span><span id="line-828"></span><span>                        </span><span class="hs-comment">-- exists in the range of the (IdEnv HowBound)</span><span>
</span><span id="line-829"></span><span>
</span><span id="line-830"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="LetBound"><span class="annot"><a href="GHC.CoreToStg.html#LetBound"><span class="hs-identifier hs-var">LetBound</span></a></span></span><span>            </span><span class="hs-comment">-- A let(rec) in this module</span><span>
</span><span id="line-831"></span><span>        </span><span class="annot"><a href="GHC.CoreToStg.html#LetInfo"><span class="hs-identifier hs-type">LetInfo</span></a></span><span>         </span><span class="hs-comment">-- Whether top level or nested</span><span>
</span><span id="line-832"></span><span>        </span><span class="annot"><a href="GHC.Types.Basic.html#Arity"><span class="hs-identifier hs-type">Arity</span></a></span><span>           </span><span class="hs-comment">-- Its arity (local Ids don't have arity info at this point)</span><span>
</span><span id="line-833"></span><span>
</span><span id="line-834"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="LambdaBound"><span class="annot"><a href="GHC.CoreToStg.html#LambdaBound"><span class="hs-identifier hs-var">LambdaBound</span></a></span></span><span>         </span><span class="hs-comment">-- Used for both lambda and case</span><span>
</span><span id="line-835"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680961421"><span id="local-6989586621680961425"><span class="annot"><span class="annottext">HowBound -&gt; HowBound -&gt; Bool
(HowBound -&gt; HowBound -&gt; Bool)
-&gt; (HowBound -&gt; HowBound -&gt; Bool) -&gt; Eq HowBound
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: HowBound -&gt; HowBound -&gt; Bool
$c/= :: HowBound -&gt; HowBound -&gt; Bool
== :: HowBound -&gt; HowBound -&gt; Bool
$c== :: HowBound -&gt; HowBound -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-836"></span><span>
</span><span id="line-837"></span><span class="hs-keyword">data</span><span> </span><span id="LetInfo"><span class="annot"><a href="GHC.CoreToStg.html#LetInfo"><span class="hs-identifier hs-var">LetInfo</span></a></span></span><span>
</span><span id="line-838"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="TopLet"><span class="annot"><a href="GHC.CoreToStg.html#TopLet"><span class="hs-identifier hs-var">TopLet</span></a></span></span><span>              </span><span class="hs-comment">-- top level things</span><span>
</span><span id="line-839"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="NestedLet"><span class="annot"><a href="GHC.CoreToStg.html#NestedLet"><span class="hs-identifier hs-var">NestedLet</span></a></span></span><span>
</span><span id="line-840"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680961416"><span id="local-6989586621680961418"><span class="annot"><span class="annottext">LetInfo -&gt; LetInfo -&gt; Bool
(LetInfo -&gt; LetInfo -&gt; Bool)
-&gt; (LetInfo -&gt; LetInfo -&gt; Bool) -&gt; Eq LetInfo
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: LetInfo -&gt; LetInfo -&gt; Bool
$c/= :: LetInfo -&gt; LetInfo -&gt; Bool
== :: LetInfo -&gt; LetInfo -&gt; Bool
$c== :: LetInfo -&gt; LetInfo -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-841"></span><span>
</span><span id="line-842"></span><span class="hs-comment">-- For a let(rec)-bound variable, x, we record LiveInfo, the set of</span><span>
</span><span id="line-843"></span><span class="hs-comment">-- variables that are live if x is live.  This LiveInfo comprises</span><span>
</span><span id="line-844"></span><span class="hs-comment">--         (a) dynamic live variables (ones with a non-top-level binding)</span><span>
</span><span id="line-845"></span><span class="hs-comment">--         (b) static live variables (CAFs or things that refer to CAFs)</span><span>
</span><span id="line-846"></span><span class="hs-comment">--</span><span>
</span><span id="line-847"></span><span class="hs-comment">-- For &quot;normal&quot; variables (a) is just x alone.  If x is a let-no-escaped</span><span>
</span><span id="line-848"></span><span class="hs-comment">-- variable then x is represented by a code pointer and a stack pointer</span><span>
</span><span id="line-849"></span><span class="hs-comment">-- (well, one for each stack).  So all of the variables needed in the</span><span>
</span><span id="line-850"></span><span class="hs-comment">-- execution of x are live if x is, and are therefore recorded in the</span><span>
</span><span id="line-851"></span><span class="hs-comment">-- LetBound constructor; x itself *is* included.</span><span>
</span><span id="line-852"></span><span class="hs-comment">--</span><span>
</span><span id="line-853"></span><span class="hs-comment">-- The set of dynamic live variables is guaranteed ot have no further</span><span>
</span><span id="line-854"></span><span class="hs-comment">-- let-no-escaped variables in it.</span><span>
</span><span id="line-855"></span><span>
</span><span id="line-856"></span><span class="hs-comment">-- The std monad functions:</span><span>
</span><span id="line-857"></span><span>
</span><span id="line-858"></span><span id="local-6989586621680962110"><span class="annot"><a href="GHC.CoreToStg.html#initCts"><span class="hs-identifier hs-type">initCts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#IdEnv"><span class="hs-identifier hs-type">IdEnv</span></a></span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#HowBound"><span class="hs-identifier hs-type">HowBound</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-type">CtsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680962110"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680962110"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-859"></span><span id="initCts"><span class="annot"><span class="annottext">initCts :: forall a. DynFlags -&gt; IdEnv HowBound -&gt; CtsM a -&gt; a
</span><a href="GHC.CoreToStg.html#initCts"><span class="hs-identifier hs-var hs-var">initCts</span></a></span></span><span> </span><span id="local-6989586621680961415"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961415"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680961414"><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961414"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680961413"><span class="annot"><span class="annottext">CtsM a
</span><a href="#local-6989586621680961413"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtsM a -&gt; DynFlags -&gt; IdEnv HowBound -&gt; a
forall a. CtsM a -&gt; DynFlags -&gt; IdEnv HowBound -&gt; a
</span><a href="GHC.CoreToStg.html#unCtsM"><span class="hs-identifier hs-var hs-var">unCtsM</span></a></span><span> </span><span class="annot"><span class="annottext">CtsM a
</span><a href="#local-6989586621680961413"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961415"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961414"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-860"></span><span>
</span><span id="line-861"></span><span>
</span><span id="line-862"></span><span>
</span><span id="line-863"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#thenCts"><span class="hs-pragma hs-type">thenCts</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-864"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#returnCts"><span class="hs-pragma hs-type">returnCts</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-865"></span><span>
</span><span id="line-866"></span><span id="local-6989586621680961995"><span class="annot"><a href="GHC.CoreToStg.html#returnCts"><span class="hs-identifier hs-type">returnCts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680961995"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-type">CtsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680961995"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-867"></span><span id="returnCts"><span class="annot"><span class="annottext">returnCts :: forall a. a -&gt; CtsM a
</span><a href="GHC.CoreToStg.html#returnCts"><span class="hs-identifier hs-var hs-var">returnCts</span></a></span></span><span> </span><span id="local-6989586621680961410"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680961410"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(DynFlags -&gt; IdEnv HowBound -&gt; a) -&gt; CtsM a
forall a. (DynFlags -&gt; IdEnv HowBound -&gt; a) -&gt; CtsM a
</span><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-var">CtsM</span></a></span><span> </span><span class="annot"><span class="annottext">((DynFlags -&gt; IdEnv HowBound -&gt; a) -&gt; CtsM a)
-&gt; (DynFlags -&gt; IdEnv HowBound -&gt; a) -&gt; CtsM a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">DynFlags
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">IdEnv HowBound
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680961410"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-868"></span><span>
</span><span id="line-869"></span><span id="local-6989586621680961992"><span id="local-6989586621680961993"><span class="annot"><a href="GHC.CoreToStg.html#thenCts"><span class="hs-identifier hs-type">thenCts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-type">CtsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680961993"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680961993"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-type">CtsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680961992"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-type">CtsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680961992"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-870"></span><span id="thenCts"><span class="annot"><span class="annottext">thenCts :: forall a b. CtsM a -&gt; (a -&gt; CtsM b) -&gt; CtsM b
</span><a href="GHC.CoreToStg.html#thenCts"><span class="hs-identifier hs-var hs-var">thenCts</span></a></span></span><span> </span><span id="local-6989586621680961409"><span class="annot"><span class="annottext">CtsM a
</span><a href="#local-6989586621680961409"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621680961408"><span class="annot"><span class="annottext">a -&gt; CtsM b
</span><a href="#local-6989586621680961408"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(DynFlags -&gt; IdEnv HowBound -&gt; b) -&gt; CtsM b
forall a. (DynFlags -&gt; IdEnv HowBound -&gt; a) -&gt; CtsM a
</span><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-var">CtsM</span></a></span><span> </span><span class="annot"><span class="annottext">((DynFlags -&gt; IdEnv HowBound -&gt; b) -&gt; CtsM b)
-&gt; (DynFlags -&gt; IdEnv HowBound -&gt; b) -&gt; CtsM b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621680961407"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961407"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680961406"><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961406"><span class="hs-identifier hs-var">env</span></a></span></span><span>
</span><span id="line-871"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">CtsM b -&gt; DynFlags -&gt; IdEnv HowBound -&gt; b
forall a. CtsM a -&gt; DynFlags -&gt; IdEnv HowBound -&gt; a
</span><a href="GHC.CoreToStg.html#unCtsM"><span class="hs-identifier hs-var hs-var">unCtsM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; CtsM b
</span><a href="#local-6989586621680961408"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtsM a -&gt; DynFlags -&gt; IdEnv HowBound -&gt; a
forall a. CtsM a -&gt; DynFlags -&gt; IdEnv HowBound -&gt; a
</span><a href="GHC.CoreToStg.html#unCtsM"><span class="hs-identifier hs-var hs-var">unCtsM</span></a></span><span> </span><span class="annot"><span class="annottext">CtsM a
</span><a href="#local-6989586621680961409"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961407"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961406"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961407"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961406"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-872"></span><span>
</span><span id="line-873"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680961396"><span id="local-6989586621680961398"><span id="local-6989586621680961400"><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-type">CtsM</span></a></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-874"></span><span>    </span><span id="local-6989586621680961394"><span class="annot"><span class="annottext">pure :: forall a. a -&gt; CtsM a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var hs-var hs-var hs-var">pure</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; CtsM a
forall a. a -&gt; CtsM a
</span><a href="GHC.CoreToStg.html#returnCts"><span class="hs-identifier hs-var">returnCts</span></a></span><span>
</span><span id="line-875"></span><span>    </span><span id="local-6989586621680961392"><span class="annot"><span class="annottext">&lt;*&gt; :: forall a b. CtsM (a -&gt; b) -&gt; CtsM a -&gt; CtsM b
</span><a href="../../base/src/GHC.Base.html#%3C%2A%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">(&lt;*&gt;)</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtsM (a -&gt; b) -&gt; CtsM a -&gt; CtsM b
forall (m :: * -&gt; *) a b. Monad m =&gt; m (a -&gt; b) -&gt; m a -&gt; m b
</span><a href="../../base/src/GHC.Base.html#ap"><span class="hs-identifier hs-var">ap</span></a></span><span>
</span><span id="line-876"></span><span>
</span><span id="line-877"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680961385"><span id="local-6989586621680961387"><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-type">CtsM</span></a></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-878"></span><span>    </span><span id="local-6989586621680961383"><span class="annot"><span class="annottext">&gt;&gt;= :: forall a b. CtsM a -&gt; (a -&gt; CtsM b) -&gt; CtsM b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var hs-var hs-var hs-var">(&gt;&gt;=)</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtsM a -&gt; (a -&gt; CtsM b) -&gt; CtsM b
forall a b. CtsM a -&gt; (a -&gt; CtsM b) -&gt; CtsM b
</span><a href="GHC.CoreToStg.html#thenCts"><span class="hs-identifier hs-var">thenCts</span></a></span><span>
</span><span id="line-879"></span><span>
</span><span id="line-880"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#HasDynFlags"><span class="hs-identifier hs-type">HasDynFlags</span></a></span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-type">CtsM</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-881"></span><span>    </span><span id="local-6989586621680961380"><span class="annot"><span class="annottext">getDynFlags :: CtsM DynFlags
</span><a href="#local-6989586621680961380"><span class="hs-identifier hs-var hs-var hs-var hs-var">getDynFlags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(DynFlags -&gt; IdEnv HowBound -&gt; DynFlags) -&gt; CtsM DynFlags
forall a. (DynFlags -&gt; IdEnv HowBound -&gt; a) -&gt; CtsM a
</span><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-var">CtsM</span></a></span><span> </span><span class="annot"><span class="annottext">((DynFlags -&gt; IdEnv HowBound -&gt; DynFlags) -&gt; CtsM DynFlags)
-&gt; (DynFlags -&gt; IdEnv HowBound -&gt; DynFlags) -&gt; CtsM DynFlags
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621680961379"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961379"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="annot"><span class="annottext">IdEnv HowBound
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961379"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-882"></span><span>
</span><span id="line-883"></span><span class="hs-comment">-- Functions specific to this monad:</span><span>
</span><span id="line-884"></span><span>
</span><span id="line-885"></span><span id="local-6989586621680962074"><span class="annot"><a href="GHC.CoreToStg.html#extendVarEnvCts"><span class="hs-identifier hs-type">extendVarEnvCts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#HowBound"><span class="hs-identifier hs-type">HowBound</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-type">CtsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680962074"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-type">CtsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680962074"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-886"></span><span id="extendVarEnvCts"><span class="annot"><span class="annottext">extendVarEnvCts :: forall a. [(Id, HowBound)] -&gt; CtsM a -&gt; CtsM a
</span><a href="GHC.CoreToStg.html#extendVarEnvCts"><span class="hs-identifier hs-var hs-var">extendVarEnvCts</span></a></span></span><span> </span><span id="local-6989586621680961378"><span class="annot"><span class="annottext">[(Id, HowBound)]
</span><a href="#local-6989586621680961378"><span class="hs-identifier hs-var">ids_w_howbound</span></a></span></span><span> </span><span id="local-6989586621680961377"><span class="annot"><span class="annottext">CtsM a
</span><a href="#local-6989586621680961377"><span class="hs-identifier hs-var">expr</span></a></span></span><span>
</span><span id="line-887"></span><span>   </span><span class="hs-glyph">=</span><span>    </span><span class="annot"><span class="annottext">(DynFlags -&gt; IdEnv HowBound -&gt; a) -&gt; CtsM a
forall a. (DynFlags -&gt; IdEnv HowBound -&gt; a) -&gt; CtsM a
</span><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-var">CtsM</span></a></span><span> </span><span class="annot"><span class="annottext">((DynFlags -&gt; IdEnv HowBound -&gt; a) -&gt; CtsM a)
-&gt; (DynFlags -&gt; IdEnv HowBound -&gt; a) -&gt; CtsM a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>   </span><span class="hs-glyph">\</span><span id="local-6989586621680961376"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961376"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680961375"><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961375"><span class="hs-identifier hs-var">env</span></a></span></span><span>
</span><span id="line-888"></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">CtsM a -&gt; DynFlags -&gt; IdEnv HowBound -&gt; a
forall a. CtsM a -&gt; DynFlags -&gt; IdEnv HowBound -&gt; a
</span><a href="GHC.CoreToStg.html#unCtsM"><span class="hs-identifier hs-var hs-var">unCtsM</span></a></span><span> </span><span class="annot"><span class="annottext">CtsM a
</span><a href="#local-6989586621680961377"><span class="hs-identifier hs-var">expr</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680961376"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IdEnv HowBound -&gt; [(Id, HowBound)] -&gt; IdEnv HowBound
forall a. VarEnv a -&gt; [(Id, a)] -&gt; VarEnv a
</span><a href="GHC.Types.Var.Env.html#extendVarEnvList"><span class="hs-identifier hs-var">extendVarEnvList</span></a></span><span> </span><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961375"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">[(Id, HowBound)]
</span><a href="#local-6989586621680961378"><span class="hs-identifier hs-var">ids_w_howbound</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-889"></span><span>
</span><span id="line-890"></span><span class="annot"><a href="GHC.CoreToStg.html#lookupVarCts"><span class="hs-identifier hs-type">lookupVarCts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-type">CtsM</span></a></span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#HowBound"><span class="hs-identifier hs-type">HowBound</span></a></span><span>
</span><span id="line-891"></span><span id="lookupVarCts"><span class="annot"><span class="annottext">lookupVarCts :: Id -&gt; CtsM HowBound
</span><a href="GHC.CoreToStg.html#lookupVarCts"><span class="hs-identifier hs-var hs-var">lookupVarCts</span></a></span></span><span> </span><span id="local-6989586621680961374"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961374"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(DynFlags -&gt; IdEnv HowBound -&gt; HowBound) -&gt; CtsM HowBound
forall a. (DynFlags -&gt; IdEnv HowBound -&gt; a) -&gt; CtsM a
</span><a href="GHC.CoreToStg.html#CtsM"><span class="hs-identifier hs-var">CtsM</span></a></span><span> </span><span class="annot"><span class="annottext">((DynFlags -&gt; IdEnv HowBound -&gt; HowBound) -&gt; CtsM HowBound)
-&gt; (DynFlags -&gt; IdEnv HowBound -&gt; HowBound) -&gt; CtsM HowBound
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">DynFlags
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680961373"><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961373"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IdEnv HowBound -&gt; Id -&gt; HowBound
</span><a href="GHC.CoreToStg.html#lookupBinding"><span class="hs-identifier hs-var">lookupBinding</span></a></span><span> </span><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961373"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961374"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-892"></span><span>
</span><span id="line-893"></span><span class="annot"><a href="GHC.CoreToStg.html#lookupBinding"><span class="hs-identifier hs-type">lookupBinding</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#IdEnv"><span class="hs-identifier hs-type">IdEnv</span></a></span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#HowBound"><span class="hs-identifier hs-type">HowBound</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#HowBound"><span class="hs-identifier hs-type">HowBound</span></a></span><span>
</span><span id="line-894"></span><span id="lookupBinding"><span class="annot"><span class="annottext">lookupBinding :: IdEnv HowBound -&gt; Id -&gt; HowBound
</span><a href="GHC.CoreToStg.html#lookupBinding"><span class="hs-identifier hs-var hs-var">lookupBinding</span></a></span></span><span> </span><span id="local-6989586621680961371"><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961371"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680961370"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961370"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IdEnv HowBound -&gt; Id -&gt; Maybe HowBound
forall a. VarEnv a -&gt; Id -&gt; Maybe a
</span><a href="GHC.Types.Var.Env.html#lookupVarEnv"><span class="hs-identifier hs-var">lookupVarEnv</span></a></span><span> </span><span class="annot"><span class="annottext">IdEnv HowBound
</span><a href="#local-6989586621680961371"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961370"><span class="hs-identifier hs-var">v</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-895"></span><span>                        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680961368"><span class="annot"><span class="annottext">HowBound
</span><a href="#local-6989586621680961368"><span class="hs-identifier hs-var">xx</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HowBound
</span><a href="#local-6989586621680961368"><span class="hs-identifier hs-var">xx</span></a></span><span>
</span><span id="line-896"></span><span>                        </span><span class="annot"><span class="annottext">Maybe HowBound
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">isGlobalId</span><span> </span><span class="hs-identifier">v</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">v</span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-identifier">ImportBound</span><span>
</span><span id="line-897"></span><span>
</span><span id="line-898"></span><span class="annot"><a href="GHC.CoreToStg.html#getAllCAFsCC"><span class="hs-identifier hs-type">getAllCAFsCC</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.CostCentre.html#CostCentre"><span class="hs-identifier hs-type">CostCentre</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.html#CostCentreStack"><span class="hs-identifier hs-type">CostCentreStack</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-899"></span><span id="getAllCAFsCC"><span class="annot"><span class="annottext">getAllCAFsCC :: Module -&gt; (CostCentre, CostCentreStack)
</span><a href="GHC.CoreToStg.html#getAllCAFsCC"><span class="hs-identifier hs-var hs-var">getAllCAFsCC</span></a></span></span><span> </span><span id="local-6989586621680961366"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680961366"><span class="hs-identifier hs-var">this_mod</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-900"></span><span>    </span><span class="hs-keyword">let</span><span>
</span><span id="line-901"></span><span>      </span><span id="local-6989586621680961365"><span class="annot"><span class="annottext">span :: SrcSpan
</span><a href="#local-6989586621680961365"><span class="hs-identifier hs-var hs-var">span</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CLabelString -&gt; SrcSpan
</span><a href="GHC.Types.SrcLoc.html#mkGeneralSrcSpan"><span class="hs-identifier hs-var">mkGeneralSrcSpan</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; CLabelString
</span><a href="GHC.Data.FastString.html#mkFastString"><span class="hs-identifier hs-var">mkFastString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&lt;entire-module&gt;&quot;</span></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- XXX do better</span><span>
</span><span id="line-902"></span><span>      </span><span id="local-6989586621680961363"><span class="annot"><span class="annottext">all_cafs_cc :: CostCentre
</span><a href="#local-6989586621680961363"><span class="hs-identifier hs-var hs-var">all_cafs_cc</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Module -&gt; SrcSpan -&gt; CostCentre
</span><a href="GHC.Types.CostCentre.html#mkAllCafsCC"><span class="hs-identifier hs-var">mkAllCafsCC</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680961366"><span class="hs-identifier hs-var">this_mod</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680961365"><span class="hs-identifier hs-var">span</span></a></span><span>
</span><span id="line-903"></span><span>      </span><span id="local-6989586621680961361"><span class="annot"><span class="annottext">all_cafs_ccs :: CostCentreStack
</span><a href="#local-6989586621680961361"><span class="hs-identifier hs-var hs-var">all_cafs_ccs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CostCentre -&gt; CostCentreStack
</span><a href="GHC.Types.CostCentre.html#mkSingletonCCS"><span class="hs-identifier hs-var">mkSingletonCCS</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentre
</span><a href="#local-6989586621680961363"><span class="hs-identifier hs-var">all_cafs_cc</span></a></span><span>
</span><span id="line-904"></span><span>    </span><span class="hs-keyword">in</span><span>
</span><span id="line-905"></span><span>      </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CostCentre
</span><a href="#local-6989586621680961363"><span class="hs-identifier hs-var">all_cafs_cc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621680961361"><span class="hs-identifier hs-var">all_cafs_ccs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-906"></span><span>
</span><span id="line-907"></span><span class="hs-comment">-- Misc.</span><span>
</span><span id="line-908"></span><span>
</span><span id="line-909"></span><span class="annot"><a href="GHC.CoreToStg.html#filterStgBinders"><span class="hs-identifier hs-type">filterStgBinders</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-910"></span><span id="filterStgBinders"><span class="annot"><span class="annottext">filterStgBinders :: [Id] -&gt; [Id]
</span><a href="GHC.CoreToStg.html#filterStgBinders"><span class="hs-identifier hs-var hs-var">filterStgBinders</span></a></span></span><span> </span><span id="local-6989586621680961360"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621680961360"><span class="hs-identifier hs-var">bndrs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Id -&gt; Bool) -&gt; [Id] -&gt; [Id]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; Bool
</span><a href="GHC.Types.Var.html#isId"><span class="hs-identifier hs-var">isId</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621680961360"><span class="hs-identifier hs-var">bndrs</span></a></span><span>
</span><span id="line-911"></span><span>
</span><span id="line-912"></span><span class="annot"><a href="GHC.CoreToStg.html#myCollectBinders"><span class="hs-identifier hs-type">myCollectBinders</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.html#Expr"><span class="hs-identifier hs-type">Expr</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.html#Expr"><span class="hs-identifier hs-type">Expr</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-913"></span><span id="myCollectBinders"><span class="annot"><span class="annottext">myCollectBinders :: CoreArg -&gt; ([Id], CoreArg)
</span><a href="GHC.CoreToStg.html#myCollectBinders"><span class="hs-identifier hs-var hs-var">myCollectBinders</span></a></span></span><span> </span><span id="local-6989586621680961358"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961358"><span class="hs-identifier hs-var">expr</span></a></span></span><span>
</span><span id="line-914"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; CoreArg -&gt; ([Id], CoreArg)
forall {a}. [a] -&gt; Expr a -&gt; ([a], Expr a)
</span><a href="#local-6989586621680961357"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961358"><span class="hs-identifier hs-var">expr</span></a></span><span>
</span><span id="line-915"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-916"></span><span>    </span><span id="local-6989586621680961357"><span class="annot"><span class="annottext">go :: [a] -&gt; Expr a -&gt; ([a], Expr a)
</span><a href="#local-6989586621680961357"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621680961356"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680961356"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Lam"><span class="hs-identifier hs-type">Lam</span></a></span><span> </span><span id="local-6989586621680961355"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680961355"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span id="local-6989586621680961354"><span class="annot"><span class="annottext">Expr a
</span><a href="#local-6989586621680961354"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Expr a -&gt; ([a], Expr a)
</span><a href="#local-6989586621680961357"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680961355"><span class="hs-identifier hs-var">b</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680961356"><span class="hs-identifier hs-var">bs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Expr a
</span><a href="#local-6989586621680961354"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-917"></span><span>    </span><span class="annot"><a href="#local-6989586621680961357"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680961353"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680961353"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Cast"><span class="hs-identifier hs-type">Cast</span></a></span><span> </span><span id="local-6989586621680961352"><span class="annot"><span class="annottext">Expr a
</span><a href="#local-6989586621680961352"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Expr a -&gt; ([a], Expr a)
</span><a href="#local-6989586621680961357"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680961353"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">Expr a
</span><a href="#local-6989586621680961352"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-918"></span><span>    </span><span class="annot"><a href="#local-6989586621680961357"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680961351"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680961351"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span id="local-6989586621680961350"><span class="annot"><span class="annottext">Expr a
</span><a href="#local-6989586621680961350"><span class="hs-identifier hs-var">e</span></a></span></span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a] -&gt; [a]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680961351"><span class="hs-identifier hs-var">bs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Expr a
</span><a href="#local-6989586621680961350"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-919"></span><span>
</span><span id="line-920"></span><span class="hs-comment">-- | Precondition: argument expression is an 'App', and there is a 'Var' at the</span><span>
</span><span id="line-921"></span><span class="hs-comment">-- head of the 'App' chain.</span><span>
</span><span id="line-922"></span><span class="annot"><a href="GHC.CoreToStg.html#myCollectArgs"><span class="hs-identifier hs-type">myCollectArgs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#CoreArg"><span class="hs-identifier hs-type">CoreArg</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#Tickish"><span class="hs-identifier hs-type">Tickish</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-923"></span><span id="myCollectArgs"><span class="annot"><span class="annottext">myCollectArgs :: CoreArg -&gt; (Id, [CoreArg], [Tickish Id])
</span><a href="GHC.CoreToStg.html#myCollectArgs"><span class="hs-identifier hs-var hs-var">myCollectArgs</span></a></span></span><span> </span><span id="local-6989586621680961348"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961348"><span class="hs-identifier hs-var">expr</span></a></span></span><span>
</span><span id="line-924"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoreArg
-&gt; [CoreArg] -&gt; [Tickish Id] -&gt; (Id, [CoreArg], [Tickish Id])
</span><a href="#local-6989586621680961347"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961348"><span class="hs-identifier hs-var">expr</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-925"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-926"></span><span>    </span><span id="local-6989586621680961347"><span class="annot"><span class="annottext">go :: CoreArg
-&gt; [CoreArg] -&gt; [Tickish Id] -&gt; (Id, [CoreArg], [Tickish Id])
</span><a href="#local-6989586621680961347"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span id="local-6989586621680961341"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961341"><span class="hs-identifier hs-var">v</span></a></span></span><span class="hs-special">)</span><span>          </span><span id="local-6989586621680961340"><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961340"><span class="hs-keyword hs-var">as</span></a></span></span><span> </span><span id="local-6989586621680961339"><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961339"><span class="hs-identifier hs-var">ts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961341"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961340"><span class="hs-keyword hs-var">as</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961339"><span class="hs-identifier hs-var">ts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-927"></span><span>    </span><span class="annot"><a href="#local-6989586621680961347"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#App"><span class="hs-identifier hs-type">App</span></a></span><span> </span><span id="local-6989586621680961338"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961338"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680961337"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961337"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">)</span><span>        </span><span id="local-6989586621680961336"><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961336"><span class="hs-keyword hs-var">as</span></a></span></span><span> </span><span id="local-6989586621680961335"><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961335"><span class="hs-identifier hs-var">ts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoreArg
-&gt; [CoreArg] -&gt; [Tickish Id] -&gt; (Id, [CoreArg], [Tickish Id])
</span><a href="#local-6989586621680961347"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961338"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961337"><span class="hs-identifier hs-var">a</span></a></span><span class="annot"><span class="annottext">CoreArg -&gt; [CoreArg] -&gt; [CoreArg]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961336"><span class="hs-keyword hs-var">as</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961335"><span class="hs-identifier hs-var">ts</span></a></span><span>
</span><span id="line-928"></span><span>    </span><span class="annot"><a href="#local-6989586621680961347"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Tick"><span class="hs-identifier hs-type">Tick</span></a></span><span> </span><span id="local-6989586621680961334"><span class="annot"><span class="annottext">Tickish Id
</span><a href="#local-6989586621680961334"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span id="local-6989586621680961333"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961333"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span>       </span><span id="local-6989586621680961332"><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961332"><span class="hs-keyword hs-var">as</span></a></span></span><span> </span><span id="local-6989586621680961331"><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961331"><span class="hs-identifier hs-var">ts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">all</span><span> </span><span class="hs-identifier">isTypeArg</span><span> </span><span class="hs-keyword">as</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-929"></span><span>                                </span><span class="annot"><span class="annottext">CoreArg
-&gt; [CoreArg] -&gt; [Tickish Id] -&gt; (Id, [CoreArg], [Tickish Id])
</span><a href="#local-6989586621680961347"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961333"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961332"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Tickish Id
</span><a href="#local-6989586621680961334"><span class="hs-identifier hs-var">t</span></a></span><span class="annot"><span class="annottext">Tickish Id -&gt; [Tickish Id] -&gt; [Tickish Id]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961331"><span class="hs-identifier hs-var">ts</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- ticks can appear in type apps</span><span>
</span><span id="line-930"></span><span>    </span><span class="annot"><a href="#local-6989586621680961347"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Cast"><span class="hs-identifier hs-type">Cast</span></a></span><span> </span><span id="local-6989586621680961328"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961328"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>       </span><span id="local-6989586621680961327"><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961327"><span class="hs-keyword hs-var">as</span></a></span></span><span> </span><span id="local-6989586621680961326"><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961326"><span class="hs-identifier hs-var">ts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoreArg
-&gt; [CoreArg] -&gt; [Tickish Id] -&gt; (Id, [CoreArg], [Tickish Id])
</span><a href="#local-6989586621680961347"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961328"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961327"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961326"><span class="hs-identifier hs-var">ts</span></a></span><span>
</span><span id="line-931"></span><span>    </span><span class="annot"><a href="#local-6989586621680961347"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Lam"><span class="hs-identifier hs-type">Lam</span></a></span><span> </span><span id="local-6989586621680961325"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961325"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span id="local-6989586621680961324"><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961324"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span>        </span><span id="local-6989586621680961323"><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961323"><span class="hs-keyword hs-var">as</span></a></span></span><span> </span><span id="local-6989586621680961322"><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961322"><span class="hs-identifier hs-var">ts</span></a></span></span><span>
</span><span id="line-932"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Bool
</span><a href="GHC.Types.Var.html#isTyVar"><span class="hs-identifier hs-var">isTyVar</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961325"><span class="hs-identifier hs-var">b</span></a></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoreArg
-&gt; [CoreArg] -&gt; [Tickish Id] -&gt; (Id, [CoreArg], [Tickish Id])
</span><a href="#local-6989586621680961347"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961324"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">[CoreArg]
</span><a href="#local-6989586621680961323"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621680961322"><span class="hs-identifier hs-var">ts</span></a></span><span> </span><span class="hs-comment">-- Note [Collect args]</span><span>
</span><span id="line-933"></span><span>    </span><span class="annot"><a href="#local-6989586621680961347"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><span class="hs-identifier">_</span></span><span>                </span><span class="annot"><span class="annottext">[CoreArg]
</span><span class="hs-identifier">_</span></span><span>  </span><span class="annot"><span class="annottext">[Tickish Id]
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; (Id, [CoreArg], [Tickish Id])
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;CoreToStg.myCollectArgs&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoreArg -&gt; SDoc
forall {a}. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">CoreArg
</span><a href="#local-6989586621680961348"><span class="hs-identifier hs-var">expr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-934"></span><span>
</span><span id="line-935"></span><span class="hs-comment">-- Note [Collect args]</span><span>
</span><span id="line-936"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-937"></span><span class="hs-comment">--</span><span>
</span><span id="line-938"></span><span class="hs-comment">-- This big-lambda case occurred following a rather obscure eta expansion.</span><span>
</span><span id="line-939"></span><span class="hs-comment">-- It all seems a bit yukky to me.</span><span>
</span><span id="line-940"></span><span>
</span><span id="line-941"></span><span class="annot"><a href="GHC.CoreToStg.html#stgArity"><span class="hs-identifier hs-type">stgArity</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CoreToStg.html#HowBound"><span class="hs-identifier hs-type">HowBound</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Arity"><span class="hs-identifier hs-type">Arity</span></a></span><span>
</span><span id="line-942"></span><span id="stgArity"><span class="annot"><span class="annottext">stgArity :: Id -&gt; HowBound -&gt; JoinArity
</span><a href="GHC.CoreToStg.html#stgArity"><span class="hs-identifier hs-var hs-var">stgArity</span></a></span></span><span> </span><span class="annot"><span class="annottext">Id
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CoreToStg.html#LetBound"><span class="hs-identifier hs-type">LetBound</span></a></span><span> </span><span class="annot"><span class="annottext">LetInfo
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680961320"><span class="annot"><span class="annottext">JoinArity
</span><a href="#local-6989586621680961320"><span class="hs-identifier hs-var">arity</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JoinArity
</span><a href="#local-6989586621680961320"><span class="hs-identifier hs-var">arity</span></a></span><span>
</span><span id="line-943"></span><span class="annot"><a href="GHC.CoreToStg.html#stgArity"><span class="hs-identifier hs-var">stgArity</span></a></span><span> </span><span id="local-6989586621680961319"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961319"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="annot"><span class="annottext">HowBound
</span><a href="GHC.CoreToStg.html#ImportBound"><span class="hs-identifier hs-var">ImportBound</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; JoinArity
</span><a href="GHC.Types.Id.html#idArity"><span class="hs-identifier hs-var">idArity</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621680961319"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-944"></span><span class="annot"><a href="GHC.CoreToStg.html#stgArity"><span class="hs-identifier hs-var">stgArity</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">HowBound
</span><a href="GHC.CoreToStg.html#LambdaBound"><span class="hs-identifier hs-var">LambdaBound</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JoinArity
</span><span class="hs-number">0</span></span><span>
</span><span id="line-945"></span></pre></body></html>